[clang-tools-extra] [clang-tidy] Fix `cppcoreguidelines-use-enum-class` anonymous enum bug (PR #215352)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 01:54:13 PDT 2026


================
@@ -10,6 +10,14 @@
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
 using namespace clang::ast_matchers;
+using namespace clang::ast_matchers::internal;
+
+namespace {
+// FIXME: The matcher 'hasName(Name)' asserts that its argument 'Name' is
+// nonempty. Perhaps remove that assertion and replace 'isUnnamed()' with
+// 'hasName("")'.
+AST_MATCHER(clang::EnumDecl, isUnnamed) { return Node.getName().empty(); }
+} // namespace
----------------
vbvictor wrote:

Place this inside `namespace clang::tidy::cppcoreguidelines` So you don't have to write clang:: prefix

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


More information about the cfe-commits mailing list