[flang-commits] [PATCH] D137859: [flang] Restore ENUM_CLASS() to be compilation-time code

Thorsten via Phabricator via flang-commits flang-commits at lists.llvm.org
Sat Nov 12 11:12:08 PST 2022


tschuett added a comment.

In D137859#3923213 <https://reviews.llvm.org/D137859#3923213>, @klausler wrote:

> In D137859#3922948 <https://reviews.llvm.org/D137859#3922948>, @tschuett wrote:
>
>> What happens if I have 2 `ENUM_CLASS`? You did not namespace `Enum2String`. There are no tests.
>
> This is not a new feature, just a rework of a recent update to it.  It should work as it always has.
>
> Multiple instances of ENUM_CLASS in the same scope are distinguished by the name of the ENUM_CLASS.
>
> EnumToString will be defined in the namespace and/or class in which the reference to the ENUM_CLASS macro appears.

Agreed. But you could still end up with two `EnumToString` in the same *context*. The only difference is the type of the parameter.

  ENUM_CLASS(RelationalOperator, LT, LE, EQ, NE, GE, GT);
  ENUM_CLASS(RelationalOperator2, LT, LE, EQ, NE, GE, GT);


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137859/new/

https://reviews.llvm.org/D137859



More information about the flang-commits mailing list