https://github.com/vbvictor updated 
https://github.com/llvm/llvm-project/pull/143482

>From 3c4c5d5b5fa85c4aa76b5ee6d654a4556c2d1e0b Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2...@gmail.com>
Date: Tue, 10 Jun 2025 09:39:49 +0300
Subject: [PATCH 1/3] [clang-tidy] fix 'misc-internal-linkage' check warnings

---
 .../clang-tidy/abseil/AbseilTidyModule.cpp    |  2 +-
 .../clang-tidy/abseil/CleanupCtadCheck.cpp    |  2 +-
 .../clang-tidy/abseil/StrCatAppendCheck.cpp   |  6 ++--
 .../abseil/StringFindStrContainsCheck.cpp     |  2 ++
 .../clang-tidy/altera/AlteraTidyModule.cpp    |  2 +-
 .../clang-tidy/android/AndroidTidyModule.cpp  |  2 +-
 .../clang-tidy/boost/BoostTidyModule.cpp      |  2 +-
 .../clang-tidy/bugprone/BranchCloneCheck.cpp  |  1 +
 .../bugprone/BugproneTidyModule.cpp           |  1 +
 .../DynamicStaticInitializersCheck.cpp        |  4 +++
 .../EasilySwappableParametersCheck.cpp        | 13 ++++++--
 .../bugprone/IncDecInConditionsCheck.cpp      |  4 +++
 .../MultipleNewInOneExpressionCheck.cpp       |  4 +--
 .../bugprone/StandaloneEmptyCheck.cpp         |  3 +-
 .../bugprone/StringviewNullptrCheck.cpp       |  2 +-
 .../bugprone/UnhandledExceptionAtNewCheck.cpp |  3 ++
 .../clang-tidy/bugprone/UnusedRaiiCheck.cpp   |  4 +--
 .../clang-tidy/bugprone/UseAfterMoveCheck.cpp |  2 +-
 .../clang-tidy/cert/CERTTidyModule.cpp        |  2 +-
 .../concurrency/ConcurrencyTidyModule.cpp     |  1 +
 .../CppCoreGuidelinesTidyModule.cpp           |  1 +
 .../VirtualClassDestructorCheck.cpp           |  4 +++
 .../clang-tidy/darwin/DarwinTidyModule.cpp    |  2 +-
 .../clang-tidy/fuchsia/FuchsiaTidyModule.cpp  |  2 +-
 .../clang-tidy/google/GoogleTidyModule.cpp    |  2 +-
 .../clang-tidy/hicpp/HICPPTidyModule.cpp      |  2 +-
 .../linuxkernel/LinuxKernelTidyModule.cpp     |  1 +
 .../clang-tidy/llvm/LLVMTidyModule.cpp        |  2 +-
 .../PreferIsaOrDynCastInConditionalsCheck.cpp | 12 +++----
 .../llvmlibc/CalleeNamespaceCheck.cpp         |  2 +-
 .../llvmlibc/LLVMLibcTidyModule.cpp           |  1 +
 .../clang-tidy/misc/MiscTidyModule.cpp        |  4 +--
 .../clang-tidy/modernize/AvoidBindCheck.cpp   |  6 ++--
 .../clang-tidy/modernize/LoopConvertCheck.cpp |  6 ++--
 .../modernize/ModernizeTidyModule.cpp         |  1 +
 .../modernize/RedundantVoidArgCheck.cpp       |  3 +-
 .../modernize/UseConstraintsCheck.cpp         |  2 +-
 .../modernize/UseEqualsDefaultCheck.cpp       |  4 +--
 .../modernize/UseStartsEndsWithCheck.cpp      |  4 +++
 .../clang-tidy/mpi/MPITidyModule.cpp          |  2 +-
 .../clang-tidy/objc/NSDateFormatterCheck.cpp  |  2 +-
 .../clang-tidy/objc/ObjCTidyModule.cpp        |  2 +-
 .../clang-tidy/openmp/OpenMPTidyModule.cpp    |  2 +-
 .../performance/MoveConstArgCheck.cpp         |  6 ++--
 .../performance/PerformanceTidyModule.cpp     |  1 +
 .../clang-tidy/plugin/ClangTidyPlugin.cpp     |  1 +
 .../portability/PortabilityTidyModule.cpp     |  1 +
 .../readability/ContainerSizeEmptyCheck.cpp   | 31 ++++++++++---------
 .../ConvertMemberFunctionsToStatic.cpp        |  4 +++
 .../MakeMemberFunctionConstCheck.cpp          |  4 +++
 .../readability/ReadabilityTidyModule.cpp     |  1 +
 .../readability/RedundantDeclarationCheck.cpp |  4 +++
 .../RedundantInlineSpecifierCheck.cpp         |  4 +--
 .../clang-tidy/tool/ClangTidyMain.cpp         |  2 +-
 .../clang-tidy/utils/NamespaceAliaser.cpp     | 11 ++++---
 .../utils/TransformerClangTidyCheck.cpp       |  2 +-
 .../zircon/TemporaryObjectsCheck.cpp          |  4 +++
 .../clang-tidy/zircon/ZirconTidyModule.cpp    |  2 +-
 58 files changed, 133 insertions(+), 76 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp 
b/clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp
index c5c42908d0c59..78605d59b4421 100644
--- a/clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp
@@ -80,6 +80,6 @@ static ClangTidyModuleRegistry::Add<AbseilModule> 
X("abseil-module",
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the AbseilModule.
-volatile int AbseilModuleAnchorSource = 0;
+volatile int AbseilModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp 
b/clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp
index 0819642be0558..8063fc540cce5 100644
--- a/clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp
@@ -18,7 +18,7 @@ using namespace ::clang::transformer;
 
 namespace clang::tidy::abseil {
 
-RewriteRuleWith<std::string> cleanupCtadCheckImpl() {
+static RewriteRuleWith<std::string> cleanupCtadCheckImpl() {
   auto WarningMessage = cat("prefer absl::Cleanup's class template argument "
                             "deduction pattern in C++17 and higher");
 
diff --git a/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp 
b/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
index 6025d3d66675a..ced92590be02e 100644
--- a/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
@@ -17,7 +17,7 @@ namespace clang::tidy::abseil {
 namespace {
 // Skips any combination of temporary materialization, temporary binding and
 // implicit casting.
-AST_MATCHER_P(Stmt, IgnoringTemporaries, ast_matchers::internal::Matcher<Stmt>,
+AST_MATCHER_P(Stmt, ignoringTemporaries, ast_matchers::internal::Matcher<Stmt>,
               InnerMatcher) {
   const Stmt *E = &Node;
   while (true) {
@@ -43,7 +43,7 @@ void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) 
{
   const auto StrCat = functionDecl(hasName("::absl::StrCat"));
   // The arguments of absl::StrCat are implicitly converted to AlphaNum. This
   // matches to the arguments because of that behavior.
-  const auto AlphaNum = IgnoringTemporaries(cxxConstructExpr(
+  const auto AlphaNum = ignoringTemporaries(cxxConstructExpr(
       argumentCountIs(1), hasType(cxxRecordDecl(hasName("::absl::AlphaNum"))),
       hasArgument(0, ignoringImpCasts(declRefExpr(to(equalsBoundNode("LHS")),
                                                   expr().bind("Arg0"))))));
@@ -62,7 +62,7 @@ void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) 
{
                    hasOverloadedOperatorName("="),
                    hasArgument(0, declRefExpr(to(decl().bind("LHS")))),
                    hasArgument(
-                       1, IgnoringTemporaries(
+                       1, ignoringTemporaries(
                               callExpr(callee(StrCat), hasArgument(0, 
AlphaNum),
                                        unless(HasAnotherReferenceToLhs))
                                   .bind("Call"))))
diff --git a/clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp 
b/clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp
index 6e89783bb51eb..0c2fe285ce060 100644
--- a/clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp
@@ -29,7 +29,9 @@ using ::clang::transformer::makeRule;
 using ::clang::transformer::node;
 using ::clang::transformer::RewriteRuleWith;
 
+namespace {
 AST_MATCHER(Type, isCharType) { return Node.isCharType(); }
+} // namespace
 
 static const char DefaultStringLikeClasses[] = "::std::basic_string;"
                                                "::std::basic_string_view;"
diff --git a/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp 
b/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
index 21610c7d1eced..02a43ba86d7bb 100644
--- a/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
@@ -43,6 +43,6 @@ static ClangTidyModuleRegistry::Add<altera::AlteraModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the AlteraModule.
-volatile int AlteraModuleAnchorSource = 0;
+volatile int AlteraModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp 
b/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp
index 1cc17daded903..17efa10909d0a 100644
--- a/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp
@@ -67,6 +67,6 @@ static ClangTidyModuleRegistry::Add<AndroidModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the AndroidModule.
-volatile int AndroidModuleAnchorSource = 0;
+volatile int AndroidModuleAnchorSource = 0; // 
NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/boost/BoostTidyModule.cpp 
b/clang-tools-extra/clang-tidy/boost/BoostTidyModule.cpp
index 79d0e380e402d..f414fe750d023 100644
--- a/clang-tools-extra/clang-tidy/boost/BoostTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/boost/BoostTidyModule.cpp
@@ -32,6 +32,6 @@ static ClangTidyModuleRegistry::Add<BoostModule> 
X("boost-module",
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the BoostModule.
-volatile int BoostModuleAnchorSource = 0;
+volatile int BoostModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
index 0b76cfb2ad8dc..a6cd68edda55e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
@@ -62,6 +62,7 @@ static bool isFallthroughSwitchBranch(const SwitchBranch 
&Branch) {
       return true; // Ignore sub-switches
     }
 
+    // NOLINTNEXTLINE(readability-identifier-naming) - FIXME
     bool TraverseSwitchCase(SwitchCase *, DataRecursionQueue * = nullptr) {
       return true; // Ignore cases
     }
diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
index 64f4a524daf0d..ed1fd138d8f1b 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -291,6 +291,7 @@ static 
ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the BugproneModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int BugproneModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
index d99e17c691485..3fe028b94771d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
@@ -15,6 +15,8 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::bugprone {
 
+namespace {
+
 AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
   const Expr *Init = Node.getInit();
   if (Init && !Init->isValueDependent()) {
@@ -25,6 +27,8 @@ AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
   return false;
 }
 
+} // namespace
+
 DynamicStaticInitializersCheck::DynamicStaticInitializersCheck(
     StringRef Name, ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
index 10868129e76da..e3f4b7cca18a1 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1497,11 +1497,13 @@ static MixableParameterRange modelMixingRange(
 
 } // namespace model
 
+namespace {
 /// Matches DeclRefExprs and their ignorable wrappers to ParmVarDecls.
 AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<Stmt>, paramRefExpr) {
   return expr(ignoringParenImpCasts(ignoringElidableConstructorCall(
       declRefExpr(to(parmVarDecl().bind("param"))))));
 }
+} // namespace
 
 namespace filter {
 
@@ -1574,8 +1576,8 @@ using ParamToSmallSetMap =
 /// Returns whether the sets mapped to the two elements in the map have at
 /// least one element in common.
 template <typename MapTy, typename ElemTy>
-bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
-                                     const ElemTy &E2) {
+static bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
+                                            const ElemTy &E2) {
   auto E1Iterator = Map.find(E1);
   auto E2Iterator = Map.find(E2);
   if (E1Iterator == Map.end() || E2Iterator == Map.end())
@@ -1882,6 +1884,8 @@ static bool prefixSuffixCoverUnderThreshold(std::size_t 
Threshold,
 
 } // namespace filter
 
+namespace {
+
 /// Matches functions that have at least the specified amount of parameters.
 AST_MATCHER_P(FunctionDecl, parameterCountGE, unsigned, N) {
   return Node.getNumParams() >= N;
@@ -1904,13 +1908,16 @@ AST_MATCHER(FunctionDecl, 
isOverloadedUnaryOrBinaryOperator) {
   }
 }
 
+} // namespace
+
 /// Returns the DefaultMinimumLength if the Value of requested minimum length
 /// is less than 2. Minimum lengths of 0 or 1 are not accepted.
 static inline unsigned clampMinimumLength(const unsigned Value) {
   return Value < 2 ? DefaultMinimumLength : Value;
 }
 
-// FIXME: Maybe unneeded, getNameForDiagnostic() is expected to change to 
return
+// FIXME: Maybe unneeded, getNameForDiagnostic() is expected to change to
+// return
 // a crafted location when the node itself is unnamed. (See D84658, D85033.)
 /// Returns the diagnostic-friendly name of the node, or empty string.
 static SmallString<64> getName(const NamedDecl *ND) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/IncDecInConditionsCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/IncDecInConditionsCheck.cpp
index 9b3b01eb02683..73bffe93146e6 100644
--- a/clang-tools-extra/clang-tidy/bugprone/IncDecInConditionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/IncDecInConditionsCheck.cpp
@@ -15,6 +15,8 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::bugprone {
 
+namespace {
+
 AST_MATCHER(BinaryOperator, isLogicalOperator) { return Node.isLogicalOp(); }
 
 AST_MATCHER(UnaryOperator, isUnaryPrePostOperator) {
@@ -26,6 +28,8 @@ AST_MATCHER(CXXOperatorCallExpr, isPrePostOperator) {
          Node.getOperator() == OO_MinusMinus;
 }
 
+} // namespace
+
 void IncDecInConditionsCheck::registerMatchers(MatchFinder *Finder) {
   auto OperatorMatcher = expr(
       anyOf(binaryOperator(anyOf(isComparisonOperator(), isLogicalOperator())),
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
index 6d75a8262b5bc..b68888cb5b928 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp
@@ -49,8 +49,6 @@ bool isExprValueStored(const Expr *E, ASTContext &C) {
   return isa<CallExpr, CXXConstructExpr>(ParentE);
 }
 
-} // namespace
-
 AST_MATCHER_P(CXXTryStmt, hasHandlerFor,
               ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
   for (unsigned NH = Node.getNumHandlers(), I = 0; I < NH; ++I) {
@@ -74,6 +72,8 @@ AST_MATCHER(CXXNewExpr, mayThrow) {
   return !OperatorNew->getType()->castAs<FunctionProtoType>()->isNothrow();
 }
 
+} // namespace
+
 void MultipleNewInOneExpressionCheck::registerMatchers(MatchFinder *Finder) {
   auto BadAllocType =
       recordType(hasDeclaration(cxxRecordDecl(hasName("::std::bad_alloc"))));
diff --git a/clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp
index 682478ecead0b..5d9e91e0b82c7 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp
@@ -46,7 +46,8 @@ using ast_matchers::stmtExpr;
 using ast_matchers::unless;
 using ast_matchers::voidType;
 
-const Expr *getCondition(const BoundNodes &Nodes, const StringRef NodeId) {
+static const Expr *getCondition(const BoundNodes &Nodes,
+                                const StringRef NodeId) {
   const auto *If = Nodes.getNodeAs<IfStmt>(NodeId);
   if (If != nullptr)
     return If->getCond();
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp
index f944ae6c5b9e3..20789b3123e2f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp
@@ -33,7 +33,7 @@ AST_MATCHER(clang::VarDecl, isDirectInitialization) {
 
 } // namespace
 
-RewriteRuleWith<std::string> stringviewNullptrCheckImpl() {
+static RewriteRuleWith<std::string> stringviewNullptrCheckImpl() {
   auto ConstructionWarning =
       cat("constructing basic_string_view from null is undefined; replace with 
"
           "the default constructor");
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp
index ca4562aa9a44f..5e220017c97f4 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp
@@ -12,6 +12,7 @@
 using namespace clang::ast_matchers;
 
 namespace clang::tidy::bugprone {
+namespace {
 
 AST_MATCHER_P(CXXTryStmt, hasHandlerFor,
               ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
@@ -36,6 +37,8 @@ AST_MATCHER(CXXNewExpr, mayThrow) {
   return !OperatorNew->getType()->castAs<FunctionProtoType>()->isNothrow();
 }
 
+} // namespace
+
 UnhandledExceptionAtNewCheck::UnhandledExceptionAtNewCheck(
     StringRef Name, ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context) {}
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
index d96e7524172bd..b17d3868dd76a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
@@ -37,8 +37,8 @@ void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) {
 }
 
 template <typename T>
-void reportDiagnostic(DiagnosticBuilder D, const T *Node, SourceRange SR,
-                      bool DefaultConstruction) {
+static void reportDiagnostic(DiagnosticBuilder D, const T *Node, SourceRange 
SR,
+                             bool DefaultConstruction) {
   const char *Replacement = " give_me_a_name";
 
   // If this is a default ctor we have to remove the parens or we'll introduce 
a
diff --git a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
index 960133159dbbf..1bcacf96a4129 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
@@ -242,7 +242,7 @@ void UseAfterMoveFinder::getUsesAndReinits(
   });
 }
 
-bool isStandardSmartPointer(const ValueDecl *VD) {
+static bool isStandardSmartPointer(const ValueDecl *VD) {
   const Type *TheType = VD->getType().getNonReferenceType().getTypePtrOrNull();
   if (!TheType)
     return false;
diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp 
b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
index 6614b10d4ce40..66fedabaf3ca6 100644
--- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
@@ -358,6 +358,6 @@ static ClangTidyModuleRegistry::Add<cert::CERTModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the CERTModule.
-volatile int CERTModuleAnchorSource = 0;
+volatile int CERTModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp 
b/clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
index 8d74d0332df82..6c58c506dc903 100644
--- a/clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
@@ -34,6 +34,7 @@ static 
ClangTidyModuleRegistry::Add<concurrency::ConcurrencyModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the ConcurrencyModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int ConcurrencyModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
index 6adef04264347..4dd9b0904f075 100644
--- 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
+++ 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
@@ -156,6 +156,7 @@ static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the CppCoreGuidelinesModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int CppCoreGuidelinesModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
index aa70b3896f16d..e31d046565677 100644
--- 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
@@ -18,6 +18,8 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::cppcoreguidelines {
 
+namespace {
+
 AST_MATCHER(CXXRecordDecl, hasPublicVirtualOrProtectedNonVirtualDestructor) {
   // We need to call Node.getDestructor() instead of matching a
   // CXXDestructorDecl. Otherwise, tests will fail for class templates, since
@@ -33,6 +35,8 @@ AST_MATCHER(CXXRecordDecl, 
hasPublicVirtualOrProtectedNonVirtualDestructor) {
            !Destructor->isVirtual()));
 }
 
+} // namespace
+
 void VirtualClassDestructorCheck::registerMatchers(MatchFinder *Finder) {
   ast_matchers::internal::Matcher<CXXRecordDecl> InheritsVirtualMethod =
       hasAnyBase(hasType(cxxRecordDecl(has(cxxMethodDecl(isVirtual())))));
diff --git a/clang-tools-extra/clang-tidy/darwin/DarwinTidyModule.cpp 
b/clang-tools-extra/clang-tidy/darwin/DarwinTidyModule.cpp
index 616a2a2a85c56..bc8c91a9ed413 100644
--- a/clang-tools-extra/clang-tidy/darwin/DarwinTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/darwin/DarwinTidyModule.cpp
@@ -32,6 +32,6 @@ static ClangTidyModuleRegistry::Add<darwin::DarwinModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the DarwinModule.
-volatile int DarwinModuleAnchorSource = 0;
+volatile int DarwinModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp 
b/clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp
index 45a79b75e0937..d7a70b39bdc55 100644
--- a/clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp
@@ -52,6 +52,6 @@ static ClangTidyModuleRegistry::Add<FuchsiaModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the FuchsiaModule.
-volatile int FuchsiaModuleAnchorSource = 0;
+volatile int FuchsiaModuleAnchorSource = 0; // 
NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp 
b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index 5b783c40ddb34..5343e2b3a5975 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -100,6 +100,6 @@ static ClangTidyModuleRegistry::Add<GoogleModule> 
X("google-module",
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the GoogleModule.
-volatile int GoogleModuleAnchorSource = 0;
+volatile int GoogleModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp 
b/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
index 38f3ab5ae85d3..65a56be3e5a05 100644
--- a/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp
@@ -119,6 +119,6 @@ static ClangTidyModuleRegistry::Add<HICPPModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the HICPPModule.
-volatile int HICPPModuleAnchorSource = 0;
+volatile int HICPPModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp 
b/clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp
index e6d64ff61d261..b8b75b7ccaefe 100644
--- a/clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp
@@ -30,6 +30,7 @@ static ClangTidyModuleRegistry::Add<LinuxKernelModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the LinuxKernelModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int LinuxKernelModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp 
b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
index e749163699b34..ceebde1595e7f 100644
--- a/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp
@@ -57,6 +57,6 @@ static ClangTidyModuleRegistry::Add<LLVMModule> 
X("llvm-module",
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the LLVMModule.
-volatile int LLVMModuleAnchorSource = 0;
+volatile int LLVMModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp 
b/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
index 9333337777705..4c138bcc564d8 100644
--- 
a/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
+++ 
b/clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
@@ -14,12 +14,11 @@
 
 using namespace clang::ast_matchers;
 
-namespace clang {
-namespace ast_matchers {
-AST_MATCHER(Expr, isMacroID) { return Node.getExprLoc().isMacroID(); }
-} // namespace ast_matchers
+namespace clang::tidy::llvm_check {
 
-namespace tidy::llvm_check {
+namespace {
+AST_MATCHER(Expr, isMacroID) { return Node.getExprLoc().isMacroID(); }
+} // namespace
 
 void PreferIsaOrDynCastInConditionalsCheck::registerMatchers(
     MatchFinder *Finder) {
@@ -125,5 +124,4 @@ void PreferIsaOrDynCastInConditionalsCheck::check(
   }
 }
 
-} // namespace tidy::llvm_check
-} // namespace clang
+} // namespace clang::tidy::llvm_check
diff --git a/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp 
b/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
index d14cd2721d9a1..4bc4d5a4691f0 100644
--- a/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
@@ -19,7 +19,7 @@ namespace clang::tidy::llvm_libc {
 
 // Gets the outermost namespace of a DeclContext, right under the Translation
 // Unit.
-const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
+static const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
   const DeclContext *Parent = Decl->getParent();
   if (Parent->isTranslationUnit())
     return Decl;
diff --git a/clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp 
b/clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
index 7f26840be7372..562d71a0891c4 100644
--- a/clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp
@@ -39,6 +39,7 @@ static ClangTidyModuleRegistry::Add<LLVMLibcModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the LLVMLibcModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int LLVMLibcModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp 
b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 54bcebca7e186..198aa48a5dca5 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -92,6 +92,6 @@ static ClangTidyModuleRegistry::Add<misc::MiscModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the MiscModule.
-volatile int MiscModuleAnchorSource = 0;
+volatile int MiscModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
-} // namespace clang::tidy
+} // namespace clang::tidy
\ No newline at end of file
diff --git a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
index a41524af56800..c9477327742d7 100644
--- a/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
@@ -452,8 +452,8 @@ static bool isFixitSupported(const CallableInfo &Callee,
   return true;
 }
 
-const FunctionDecl *getCallOperator(const CXXRecordDecl *Callable,
-                                    size_t NumArgs) {
+static const FunctionDecl *getCallOperator(const CXXRecordDecl *Callable,
+                                           size_t NumArgs) {
   std::vector<const FunctionDecl *> Candidates =
       findCandidateCallOperators(Callable, NumArgs);
   if (Candidates.size() != 1)
@@ -462,7 +462,7 @@ const FunctionDecl *getCallOperator(const CXXRecordDecl 
*Callable,
   return Candidates.front();
 }
 
-const FunctionDecl *
+static const FunctionDecl *
 getCallMethodDecl(const MatchFinder::MatchResult &Result, CallableType Type,
                   CallableMaterializationKind Materialization) {
 
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index eb11ae6162028..6c6c626ec4fed 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -114,7 +114,7 @@ arrayConditionMatcher(internal::Matcher<Expr> LimitExpr) {
 /// Client code will need to make sure that:
 ///   - The index variable is only used as an array index.
 ///   - All arrays indexed by the loop are the same.
-StatementMatcher makeArrayLoopMatcher() {
+static StatementMatcher makeArrayLoopMatcher() {
   StatementMatcher ArrayBoundMatcher =
       expr(hasType(isInteger())).bind(ConditionBoundName);
 
@@ -155,7 +155,7 @@ StatementMatcher makeArrayLoopMatcher() {
 ///
 /// Client code will need to make sure that:
 ///   - The two containers on which 'begin' and 'end' are called are the same.
-StatementMatcher makeIteratorLoopMatcher(bool IsReverse) {
+static StatementMatcher makeIteratorLoopMatcher(bool IsReverse) {
 
   auto BeginNameMatcher = IsReverse ? hasAnyName("rbegin", "crbegin")
                                     : hasAnyName("begin", "cbegin");
@@ -267,7 +267,7 @@ StatementMatcher makeIteratorLoopMatcher(bool IsReverse) {
 ///   - The index variable is only used in overloaded operator[] or
 ///     container.at().
 ///   - The container's iterators would not be invalidated during the loop.
-StatementMatcher makePseudoArrayLoopMatcher() {
+static StatementMatcher makePseudoArrayLoopMatcher() {
   // Test that the incoming type has a record declaration that has methods
   // called 'begin' and 'end'. If the incoming type is const, then make sure
   // these methods are also marked const.
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp 
b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index e872759856f3c..0cf59b6e0216a 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -136,6 +136,7 @@ static ClangTidyModuleRegistry::Add<ModernizeModule> 
X("modernize-module",
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the ModernizeModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int ModernizeModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
index 53447c2b960f9..5eebccc366fd5 100644
--- a/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
@@ -112,7 +112,8 @@ void RedundantVoidArgCheck::processFunctionDecl(
                              "function declaration");
 }
 
-bool isMacroIdentifier(const IdentifierTable &Idents, const Token &ProtoToken) 
{
+static bool isMacroIdentifier(const IdentifierTable &Idents,
+                              const Token &ProtoToken) {
   if (!ProtoToken.is(tok::TokenKind::raw_identifier))
     return false;
 
diff --git a/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp
index 6040cddf0e52a..9e4d184c4b6e1 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp
@@ -279,7 +279,7 @@ findInsertionForConstraint(const FunctionDecl *Function, 
ASTContext &Context) {
   return Body->getBeginLoc();
 }
 
-bool isPrimaryExpression(const Expr *Expression) {
+static bool isPrimaryExpression(const Expr *Expression) {
   // This function is an incomplete approximation of checking whether
   // an Expr is a primary expression. In particular, if this function
   // returns true, the expression is a primary expression. The converse
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index 93151024064b4..b361ae4456538 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -48,8 +48,8 @@ static std::set<const Type *> getAllDirectBases(const 
CXXRecordDecl *Record) {
 /// Returns a matcher that matches member expressions where the base is
 /// the variable declared as \p Var and the accessed member is the one declared
 /// as \p Field.
-internal::Matcher<Expr> accessToFieldInVar(const FieldDecl *Field,
-                                           const ValueDecl *Var) {
+static internal::Matcher<Expr> accessToFieldInVar(const FieldDecl *Field,
+                                                  const ValueDecl *Var) {
   return ignoringImpCasts(
       
memberExpr(hasObjectExpression(declRefExpr(to(varDecl(equalsNode(Var))))),
                  member(fieldDecl(equalsNode(Field)))));
diff --git a/clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp
index 2e059f24d47b6..2af67f7ccb4c1 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp
@@ -33,6 +33,8 @@ static bool isNegativeComparison(const Expr *ComparisonExpr) {
   return false;
 }
 
+namespace {
+
 struct NotLengthExprForStringNode {
   NotLengthExprForStringNode(std::string ID, DynTypedNode Node,
                              ASTContext *Context)
@@ -91,6 +93,8 @@ AST_MATCHER_P(Expr, lengthExprForStringNode, std::string, ID) 
{
       ID, DynTypedNode::create(Node), &(Finder->getASTContext())));
 }
 
+} // namespace
+
 UseStartsEndsWithCheck::UseStartsEndsWithCheck(StringRef Name,
                                                ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context) {}
diff --git a/clang-tools-extra/clang-tidy/mpi/MPITidyModule.cpp 
b/clang-tools-extra/clang-tidy/mpi/MPITidyModule.cpp
index 166d71e130db5..67ae101c18cb1 100644
--- a/clang-tools-extra/clang-tidy/mpi/MPITidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/mpi/MPITidyModule.cpp
@@ -31,6 +31,6 @@ static ClangTidyModuleRegistry::Add<mpi::MPIModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the MPIModule.
-volatile int MPIModuleAnchorSource = 0;
+volatile int MPIModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp 
b/clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp
index 5438c9c892e2e..79e9d97d9594b 100644
--- a/clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/objc/NSDateFormatterCheck.cpp
@@ -34,7 +34,7 @@ static char ValidDatePatternChars[] = {
 // A string pattern is valid if all the letters(a-z, A-Z) in it belong to the
 // set of reserved characters. See:
 // https://www.unicode.org/reports/tr35/tr35.html#Invalid_Patterns
-bool isValidDatePattern(StringRef Pattern) {
+static bool isValidDatePattern(StringRef Pattern) {
   return llvm::all_of(Pattern, [](const auto &PatternChar) {
     return !isalpha(PatternChar) ||
            llvm::is_contained(ValidDatePatternChars, PatternChar);
diff --git a/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp 
b/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
index 35113f80870f6..56ccf33a6362a 100644
--- a/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/objc/ObjCTidyModule.cpp
@@ -53,6 +53,6 @@ static ClangTidyModuleRegistry::Add<ObjCModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the ObjCModule.
-volatile int ObjCModuleAnchorSource = 0;
+volatile int ObjCModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/openmp/OpenMPTidyModule.cpp 
b/clang-tools-extra/clang-tidy/openmp/OpenMPTidyModule.cpp
index 37092f49b25d6..d9c9d90673408 100644
--- a/clang-tools-extra/clang-tidy/openmp/OpenMPTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/openmp/OpenMPTidyModule.cpp
@@ -34,6 +34,6 @@ static ClangTidyModuleRegistry::Add<OpenMPModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the OpenMPModule.
-volatile int OpenMPModuleAnchorSource = 0;
+volatile int OpenMPModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp 
b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 75ef7a697031e..f458e26d964b0 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -78,9 +78,9 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) 
{
       this);
 }
 
-bool isRValueReferenceParam(const Expr *Invocation,
-                            const QualType *InvocationParmType,
-                            const Expr *Arg) {
+static bool isRValueReferenceParam(const Expr *Invocation,
+                                   const QualType *InvocationParmType,
+                                   const Expr *Arg) {
   if (Invocation && (*InvocationParmType)->isRValueReferenceType() &&
       Arg->isLValue()) {
     if (!Invocation->getType()->isRecordType())
diff --git a/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp 
b/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
index 9e0fa6f88b36a..10ad9ec6fef4c 100644
--- a/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
@@ -81,6 +81,7 @@ static ClangTidyModuleRegistry::Add<PerformanceModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the PerformanceModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int PerformanceModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp 
b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
index 3caa222b9fa4c..651a63b3aa972 100644
--- a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
+++ b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
@@ -78,6 +78,7 @@ class ClangTidyPluginAction : public PluginASTAction {
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the clang-tidy plugin.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int ClangTidyPluginAnchorSource = 0;
 
 static clang::FrontendPluginRegistry::Add<clang::tidy::ClangTidyPluginAction>
diff --git a/clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp
index a15cb36dfdaff..98853556588b3 100644
--- a/clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp
@@ -42,6 +42,7 @@ static ClangTidyModuleRegistry::Add<PortabilityModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the PortabilityModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int PortabilityModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
index bf7a847dff103..ce736a8d16023 100644
--- a/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
@@ -16,29 +16,31 @@
 
 using namespace clang::ast_matchers;
 
-namespace clang {
-namespace ast_matchers {
+namespace clang::tidy::readability {
+
+namespace {
 
 AST_POLYMORPHIC_MATCHER_P2(hasAnyArgumentWithParam,
                            AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr,
                                                            CXXConstructExpr),
-                           internal::Matcher<Expr>, ArgMatcher,
-                           internal::Matcher<ParmVarDecl>, ParamMatcher) {
-  BoundNodesTreeBuilder Result;
+                           ast_matchers::internal::Matcher<Expr>, ArgMatcher,
+                           ast_matchers::internal::Matcher<ParmVarDecl>,
+                           ParamMatcher) {
+  ast_matchers::internal::BoundNodesTreeBuilder Result;
   // The first argument of an overloaded member operator is the implicit object
   // argument of the method which should not be matched against a parameter, so
   // we skip over it here.
-  BoundNodesTreeBuilder Matches;
+  ast_matchers::internal::BoundNodesTreeBuilder Matches;
   unsigned ArgIndex = cxxOperatorCallExpr(callee(cxxMethodDecl()))
                               .matches(Node, Finder, &Matches)
                           ? 1
                           : 0;
   int ParamIndex = 0;
   for (; ArgIndex < Node.getNumArgs(); ++ArgIndex) {
-    BoundNodesTreeBuilder ArgMatches(*Builder);
+    ast_matchers::internal::BoundNodesTreeBuilder ArgMatches(*Builder);
     if (ArgMatcher.matches(*(Node.getArg(ArgIndex)->IgnoreParenCasts()), 
Finder,
                            &ArgMatches)) {
-      BoundNodesTreeBuilder ParamMatches(ArgMatches);
+      ast_matchers::internal::BoundNodesTreeBuilder ParamMatches(ArgMatches);
       if (expr(anyOf(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
                          hasParameter(ParamIndex, ParamMatcher)))),
                      callExpr(callee(functionDecl(
@@ -80,9 +82,10 @@ AST_MATCHER(Expr, usedInBooleanContext) {
                      binaryOperator(hasAnyOperatorName("&&", "||")),
                      unaryOperator(hasOperatorName("!")).bind("NegOnSize"))))))
           .matches(Node, Finder, Builder);
-  Builder->removeBindings([ExprName](const BoundNodesMap &Nodes) {
-    return Nodes.getNode(ExprName).getNodeKind().isNone();
-  });
+  Builder->removeBindings(
+      [ExprName](const ast_matchers::internal::BoundNodesMap &Nodes) {
+        return Nodes.getNode(ExprName).getNodeKind().isNone();
+      });
   return Result;
 }
 
@@ -107,8 +110,7 @@ AST_MATCHER_P(UserDefinedLiteral, hasLiteral,
   return false;
 }
 
-} // namespace ast_matchers
-namespace tidy::readability {
+} // namespace
 
 using utils::isBinaryOrTernary;
 
@@ -407,5 +409,4 @@ void ContainerSizeEmptyCheck::check(const 
MatchFinder::MatchResult &Result) {
       << Container;
 }
 
-} // namespace tidy::readability
-} // namespace clang
+} // namespace clang::tidy::readability
diff --git 
a/clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp 
b/clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp
index beca824c8c8ce..30df40bda57d8 100644
--- 
a/clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp
+++ 
b/clang-tools-extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp
@@ -18,6 +18,8 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::readability {
 
+namespace {
+
 AST_MATCHER(CXXMethodDecl, isStatic) { return Node.isStatic(); }
 
 AST_MATCHER(CXXMethodDecl, hasTrivialBody) { return Node.hasTrivialBody(); }
@@ -74,6 +76,8 @@ AST_MATCHER(CXXMethodDecl, usesThis) {
   return UsageOfThis.Used;
 }
 
+} // namespace
+
 void ConvertMemberFunctionsToStatic::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
       cxxMethodDecl(
diff --git 
a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
index d42fcba70e81b..85852c2c829a1 100644
--- a/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MakeMemberFunctionConstCheck.cpp
@@ -17,6 +17,8 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::readability {
 
+namespace {
+
 AST_MATCHER(CXXMethodDecl, isStatic) { return Node.isStatic(); }
 
 AST_MATCHER(CXXMethodDecl, hasTrivialBody) { return Node.hasTrivialBody(); }
@@ -214,6 +216,8 @@ AST_MATCHER(CXXMethodDecl, usesThisAsConst) {
   return UsageOfThis.Usage == Const;
 }
 
+} // namespace
+
 void MakeMemberFunctionConstCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
       traverse(
diff --git a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
index 4c0812f0e6793..d59b0312673b9 100644
--- a/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -186,6 +186,7 @@ static ClangTidyModuleRegistry::Add<ReadabilityModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the ReadabilityModule.
+// NOLINTNEXTLINE(misc-use-internal-linkage)
 volatile int ReadabilityModuleAnchorSource = 0;
 
 } // namespace clang::tidy
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
index 7850a6f29995f..053892dffc7b6 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
@@ -15,10 +15,14 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::readability {
 
+namespace {
+
 AST_MATCHER(FunctionDecl, doesDeclarationForceExternallyVisibleDefinition) {
   return Node.doesDeclarationForceExternallyVisibleDefinition();
 }
 
+} // namespace
+
 RedundantDeclarationCheck::RedundantDeclarationCheck(StringRef Name,
                                                      ClangTidyContext *Context)
     : ClangTidyCheck(Name, Context),
diff --git 
a/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
index 1693e5c5e9cd4..969bf2d1add6b 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp
@@ -38,8 +38,8 @@ AST_POLYMORPHIC_MATCHER(isInlineSpecified,
 AST_POLYMORPHIC_MATCHER_P(isInternalLinkage,
                           AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
                                                           VarDecl),
-                          bool, strictMode) {
-  if (!strictMode)
+                          bool, StrictMode) {
+  if (!StrictMode)
     return false;
   if (const auto *FD = dyn_cast<FunctionDecl>(&Node))
     return FD->getStorageClass() == SC_Static || FD->isInAnonymousNamespace();
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp 
b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index dc36db4e0e8d9..4336c723bd7cd 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -447,7 +447,7 @@ 
createOptionsProvider(llvm::IntrusiveRefCntPtr<vfs::FileSystem> FS) {
       std::move(OverrideOptions), std::move(FS));
 }
 
-llvm::IntrusiveRefCntPtr<vfs::FileSystem>
+static llvm::IntrusiveRefCntPtr<vfs::FileSystem>
 getVfsFromFile(const std::string &OverlayFile,
                llvm::IntrusiveRefCntPtr<vfs::FileSystem> BaseFS) {
   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
diff --git a/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.cpp 
b/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.cpp
index 4703ce1269819..22cf23fb2446e 100644
--- a/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.cpp
+++ b/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.cpp
@@ -16,15 +16,16 @@
 namespace clang::tidy::utils {
 
 using namespace ast_matchers;
+namespace {
+AST_MATCHER_P(NamespaceAliasDecl, hasTargetNamespace,
+              ast_matchers::internal::Matcher<NamespaceDecl>, InnerMatcher) {
+  return InnerMatcher.matches(*Node.getNamespace(), Finder, Builder);
+}
+} // namespace
 
 NamespaceAliaser::NamespaceAliaser(const SourceManager &SourceMgr)
     : SourceMgr(SourceMgr) {}
 
-AST_MATCHER_P(NamespaceAliasDecl, hasTargetNamespace,
-              ast_matchers::internal::Matcher<NamespaceDecl>, innerMatcher) {
-  return innerMatcher.matches(*Node.getNamespace(), Finder, Builder);
-}
-
 std::optional<FixItHint>
 NamespaceAliaser::createAlias(ASTContext &Context, const Stmt &Statement,
                               StringRef Namespace,
diff --git a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
index a40433e38a041..7d84a4a9331b1 100644
--- a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
@@ -30,7 +30,7 @@ static void verifyRule(const RewriteRuleWith<std::string> 
&Rule) {
 // If a string unintentionally containing '%' is passed as a diagnostic, Clang
 // will claim the string is ill-formed and assert-fail. This function escapes
 // such strings so they can be safely used in diagnostics.
-std::string escapeForDiagnostic(std::string ToEscape) {
+static std::string escapeForDiagnostic(std::string ToEscape) {
   // Optimize for the common case that the string does not contain `%` at the
   // cost of an extra scan over the string in the slow case.
   auto Pos = ToEscape.find('%');
diff --git a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp 
b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
index bb2976081a692..bb2c71913193b 100644
--- a/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
@@ -17,11 +17,15 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::zircon {
 
+namespace {
+
 AST_MATCHER_P(CXXRecordDecl, matchesAnyName, ArrayRef<StringRef>, Names) {
   std::string QualifiedName = Node.getQualifiedNameAsString();
   return llvm::is_contained(Names, QualifiedName);
 }
 
+} // namespace
+
 void TemporaryObjectsCheck::registerMatchers(MatchFinder *Finder) {
   // Matcher for default constructors.
   Finder->addMatcher(
diff --git a/clang-tools-extra/clang-tidy/zircon/ZirconTidyModule.cpp 
b/clang-tools-extra/clang-tidy/zircon/ZirconTidyModule.cpp
index 000680455d617..0eb5683a94e41 100644
--- a/clang-tools-extra/clang-tidy/zircon/ZirconTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/zircon/ZirconTidyModule.cpp
@@ -32,6 +32,6 @@ static ClangTidyModuleRegistry::Add<ZirconModule>
 
 // This anchor is used to force the linker to link in the generated object file
 // and thus register the ZirconModule.
-volatile int ZirconModuleAnchorSource = 0;
+volatile int ZirconModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
 } // namespace clang::tidy

>From 5d030d1f17d7a606d3ba25145974cb4eb854b76e Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2...@gmail.com>
Date: Tue, 10 Jun 2025 09:47:12 +0300
Subject: [PATCH 2/3] fix misc tidy module newline

---
 clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp 
b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 198aa48a5dca5..6ddebcbc0e152 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -94,4 +94,4 @@ static ClangTidyModuleRegistry::Add<misc::MiscModule>
 // and thus register the MiscModule.
 volatile int MiscModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
 
-} // namespace clang::tidy
\ No newline at end of file
+} // namespace clang::tidy

>From 00c9a7d947f14c92e6495e5efa24fd5e70055f4c Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2...@gmail.com>
Date: Tue, 10 Jun 2025 18:30:51 +0300
Subject: [PATCH 3/3] fix unnecessary line break

---
 .../clang-tidy/bugprone/EasilySwappableParametersCheck.cpp     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
index e3f4b7cca18a1..a179d4bf66b4d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1916,8 +1916,7 @@ static inline unsigned clampMinimumLength(const unsigned 
Value) {
   return Value < 2 ? DefaultMinimumLength : Value;
 }
 
-// FIXME: Maybe unneeded, getNameForDiagnostic() is expected to change to
-// return
+// FIXME: Maybe unneeded, getNameForDiagnostic() is expected to change to 
return
 // a crafted location when the node itself is unnamed. (See D84658, D85033.)
 /// Returns the diagnostic-friendly name of the node, or empty string.
 static SmallString<64> getName(const NamedDecl *ND) {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to