[clang-tools-extra] [clang-tidy] Option to ignore anonymous namespaces in avoid-non-const-global-variables (PR #93827)

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 15 03:06:22 PDT 2024


================
@@ -7,21 +7,30 @@
 //===----------------------------------------------------------------------===//
 
 #include "AvoidNonConstGlobalVariablesCheck.h"
-#include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
 
 using namespace clang::ast_matchers;
 
 namespace clang::tidy::cppcoreguidelines {
 
+AvoidNonConstGlobalVariablesCheck::AvoidNonConstGlobalVariablesCheck(
+    StringRef Name, ClangTidyContext *Context)
+    : ClangTidyCheck(Name, Context),
+      AllowInternalLinkage(Options.get("AllowInternalLinkage", false)) {}
----------------
SimplyDanny wrote:

Option name could be a constant to avoid duplication.

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


More information about the cfe-commits mailing list