[flang-commits] [flang] [flang][common] return ENUM_CLASS names definition to original state (PR #143553)
Andre Kuhlenschmidt via flang-commits
flang-commits at lists.llvm.org
Tue Jun 10 08:25:44 PDT 2025
https://github.com/akuhlens created https://github.com/llvm/llvm-project/pull/143553
This PR simply reverts a few lines in bf60aa1c551ef5de62fd1d1cdcbff58cba55cacd to there status in bcba39a56fd4e1debe3854d564c3e03bf0a50ee6 so that they are constant for some of the build tests that require it.
>From 4cba5de0e546bfdc947a3560d8aa953e98c04d32 Mon Sep 17 00:00:00 2001
From: Andre Kuhlenschmidt <akuhlenschmi at nvidia.com>
Date: Tue, 10 Jun 2025 08:11:53 -0700
Subject: [PATCH] return line of PR to original implementation
---
flang/include/flang/Common/enum-class.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/flang/include/flang/Common/enum-class.h b/flang/include/flang/Common/enum-class.h
index 0635a0c85be05..9f9134ee3ff7a 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/flang/include/flang/Common/enum-class.h
@@ -62,14 +62,13 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
enum class NAME { __VA_ARGS__ }; \
[[maybe_unused]] static constexpr std::size_t NAME##_enumSize{ \
::Fortran::common::CountEnumNames(#__VA_ARGS__)}; \
- [[maybe_unused]] static constexpr std::array<std::string_view, \
- NAME##_enumSize> NAME##_names{ \
- ::Fortran::common::EnumNames<NAME##_enumSize>(#__VA_ARGS__)}; \
[[maybe_unused]] static inline std::size_t EnumToInt(NAME e) { \
return static_cast<std::size_t>(e); \
} \
[[maybe_unused]] static inline std::string_view EnumToString(NAME e) { \
- return NAME##_names[static_cast<std::size_t>(e)]; \
+ static const constexpr auto names{ \
+ ::Fortran::common::EnumNames<NAME##_enumSize>(#__VA_ARGS__)}; \
+ return names[static_cast<std::size_t>(e)]; \
} \
[[maybe_unused]] inline void ForEach##NAME(std::function<void(NAME)> f) { \
for (std::size_t i{0}; i < NAME##_enumSize; ++i) { \
More information about the flang-commits
mailing list