[clang-tools-extra] [clang-tidy] performance-enum-size should ignore enums within extern "C" (PR #178233)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 27 12:55:59 PST 2026


================
@@ -25,6 +25,17 @@ namespace {
 
 AST_MATCHER(EnumDecl, hasEnumerators) { return !Node.enumerators().empty(); }
 
+AST_MATCHER(EnumDecl, isExternC) {
+  return Node.getLexicalDeclContext()->isExternCContext();
----------------
vbvictor wrote:

Can we use regular `getDeclContext()`? I suppose we need to be semantically in `extern C` or I'm missing something?

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


More information about the cfe-commits mailing list