[clang-tools-extra] [clang-tidy] Add AllowExplicitReferencedInitialValues to `readability-enum-initial-value` (PR #189459)

Björn Svensson via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 05:08:31 PDT 2026


================
@@ -37,10 +59,13 @@ static bool isOnlyFirstEnumeratorInitialized(const EnumDecl &Node) {
   return !IsFirst;
 }
 
-static bool areAllEnumeratorsInitialized(const EnumDecl &Node) {
-  return llvm::all_of(Node.enumerators(), [](const EnumConstantDecl *ECD) {
-    return ECD->getInitExpr() != nullptr;
-  });
+static bool areAllEnumeratorsInitialized(const EnumDecl &Node,
+                                         bool AllowSelfRefs) {
+  return llvm::all_of(Node.enumerators(),
+                      [AllowSelfRefs](const EnumConstantDecl *ECD) {
+                        return isAllowedSelfReference(ECD, AllowSelfRefs) ||
----------------
bjosv wrote:

Oh, well spotted. Yes, reverted

https://github.com/llvm/llvm-project/pull/189459


More information about the cfe-commits mailing list