Skip to content

Commit d502c68

Browse files
authored
[flang][common] return ENUM_CLASS names definition to original state (llvm#143553)
This PR simply reverts a few lines in bf60aa1 to their state in bcba39a so that they are constant for some of the build tests that require it. This should fix the breakage caused by llvm#142022.
1 parent c926bff commit d502c68

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

flang/include/flang/Common/enum-class.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
6262
enum class NAME { __VA_ARGS__ }; \
6363
[[maybe_unused]] static constexpr std::size_t NAME##_enumSize{ \
6464
::Fortran::common::CountEnumNames(#__VA_ARGS__)}; \
65-
[[maybe_unused]] static constexpr std::array<std::string_view, \
66-
NAME##_enumSize> NAME##_names{ \
67-
::Fortran::common::EnumNames<NAME##_enumSize>(#__VA_ARGS__)}; \
6865
[[maybe_unused]] static inline std::size_t EnumToInt(NAME e) { \
6966
return static_cast<std::size_t>(e); \
7067
} \
7168
[[maybe_unused]] static inline std::string_view EnumToString(NAME e) { \
72-
return NAME##_names[static_cast<std::size_t>(e)]; \
69+
static const constexpr auto names{ \
70+
::Fortran::common::EnumNames<NAME##_enumSize>(#__VA_ARGS__)}; \
71+
return names[static_cast<std::size_t>(e)]; \
7372
} \
7473
[[maybe_unused]] inline void ForEach##NAME(std::function<void(NAME)> f) { \
7574
for (std::size_t i{0}; i < NAME##_enumSize; ++i) { \

0 commit comments

Comments
 (0)