Skip to content

Commit 94877ce

Browse files
authored
[clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (#143482)
Run misc-use-internal-linkage check over clang-tidy code. Also fixed a couple of other clang-tidy warnings. Apart from issues in header files, all '.cpp' in `clang-tools-extra/clang-tidy` must be clang-tidy clear now.
1 parent 719e7be commit 94877ce

File tree

58 files changed

+130
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+130
-74
lines changed

clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ static ClangTidyModuleRegistry::Add<AbseilModule> X("abseil-module",
8080

8181
// This anchor is used to force the linker to link in the generated object file
8282
// and thus register the AbseilModule.
83-
volatile int AbseilModuleAnchorSource = 0;
83+
volatile int AbseilModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
8484

8585
} // namespace clang::tidy

clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using namespace ::clang::transformer;
1818

1919
namespace clang::tidy::abseil {
2020

21-
RewriteRuleWith<std::string> cleanupCtadCheckImpl() {
21+
static RewriteRuleWith<std::string> cleanupCtadCheckImpl() {
2222
auto WarningMessage = cat("prefer absl::Cleanup's class template argument "
2323
"deduction pattern in C++17 and higher");
2424

clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace clang::tidy::abseil {
1717
namespace {
1818
// Skips any combination of temporary materialization, temporary binding and
1919
// implicit casting.
20-
AST_MATCHER_P(Stmt, IgnoringTemporaries, ast_matchers::internal::Matcher<Stmt>,
20+
AST_MATCHER_P(Stmt, ignoringTemporaries, ast_matchers::internal::Matcher<Stmt>,
2121
InnerMatcher) {
2222
const Stmt *E = &Node;
2323
while (true) {
@@ -43,7 +43,7 @@ void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) {
4343
const auto StrCat = functionDecl(hasName("::absl::StrCat"));
4444
// The arguments of absl::StrCat are implicitly converted to AlphaNum. This
4545
// matches to the arguments because of that behavior.
46-
const auto AlphaNum = IgnoringTemporaries(cxxConstructExpr(
46+
const auto AlphaNum = ignoringTemporaries(cxxConstructExpr(
4747
argumentCountIs(1), hasType(cxxRecordDecl(hasName("::absl::AlphaNum"))),
4848
hasArgument(0, ignoringImpCasts(declRefExpr(to(equalsBoundNode("LHS")),
4949
expr().bind("Arg0"))))));
@@ -62,7 +62,7 @@ void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) {
6262
hasOverloadedOperatorName("="),
6363
hasArgument(0, declRefExpr(to(decl().bind("LHS")))),
6464
hasArgument(
65-
1, IgnoringTemporaries(
65+
1, ignoringTemporaries(
6666
callExpr(callee(StrCat), hasArgument(0, AlphaNum),
6767
unless(HasAnotherReferenceToLhs))
6868
.bind("Call"))))

clang-tools-extra/clang-tidy/abseil/StringFindStrContainsCheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ using ::clang::transformer::makeRule;
2929
using ::clang::transformer::node;
3030
using ::clang::transformer::RewriteRuleWith;
3131

32+
namespace {
3233
AST_MATCHER(Type, isCharType) { return Node.isCharType(); }
34+
} // namespace
3335

3436
static const char DefaultStringLikeClasses[] = "::std::basic_string;"
3537
"::std::basic_string_view;"

clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ static ClangTidyModuleRegistry::Add<altera::AlteraModule>
4343

4444
// This anchor is used to force the linker to link in the generated object file
4545
// and thus register the AlteraModule.
46-
volatile int AlteraModuleAnchorSource = 0;
46+
volatile int AlteraModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
4747

4848
} // namespace clang::tidy

clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ static ClangTidyModuleRegistry::Add<AndroidModule>
6767

6868
// This anchor is used to force the linker to link in the generated object file
6969
// and thus register the AndroidModule.
70-
volatile int AndroidModuleAnchorSource = 0;
70+
volatile int AndroidModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
7171

7272
} // namespace clang::tidy

clang-tools-extra/clang-tidy/boost/BoostTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ static ClangTidyModuleRegistry::Add<BoostModule> X("boost-module",
3232

3333
// This anchor is used to force the linker to link in the generated object file
3434
// and thus register the BoostModule.
35-
volatile int BoostModuleAnchorSource = 0;
35+
volatile int BoostModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
3636

3737
} // namespace clang::tidy

clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
6262
return true; // Ignore sub-switches
6363
}
6464

65+
// NOLINTNEXTLINE(readability-identifier-naming) - FIXME
6566
bool TraverseSwitchCase(SwitchCase *, DataRecursionQueue * = nullptr) {
6667
return true; // Ignore cases
6768
}

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
291291

292292
// This anchor is used to force the linker to link in the generated object file
293293
// and thus register the BugproneModule.
294+
// NOLINTNEXTLINE(misc-use-internal-linkage)
294295
volatile int BugproneModuleAnchorSource = 0;
295296

296297
} // namespace clang::tidy

clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ using namespace clang::ast_matchers;
1515

1616
namespace clang::tidy::bugprone {
1717

18+
namespace {
19+
1820
AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
1921
const Expr *Init = Node.getInit();
2022
if (Init && !Init->isValueDependent()) {
@@ -25,6 +27,8 @@ AST_MATCHER(clang::VarDecl, hasConstantDeclaration) {
2527
return false;
2628
}
2729

30+
} // namespace
31+
2832
DynamicStaticInitializersCheck::DynamicStaticInitializersCheck(
2933
StringRef Name, ClangTidyContext *Context)
3034
: ClangTidyCheck(Name, Context),

clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,11 +1497,13 @@ static MixableParameterRange modelMixingRange(
14971497

14981498
} // namespace model
14991499

1500+
namespace {
15001501
/// Matches DeclRefExprs and their ignorable wrappers to ParmVarDecls.
15011502
AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<Stmt>, paramRefExpr) {
15021503
return expr(ignoringParenImpCasts(ignoringElidableConstructorCall(
15031504
declRefExpr(to(parmVarDecl().bind("param"))))));
15041505
}
1506+
} // namespace
15051507

15061508
namespace filter {
15071509

@@ -1574,8 +1576,8 @@ using ParamToSmallSetMap =
15741576
/// Returns whether the sets mapped to the two elements in the map have at
15751577
/// least one element in common.
15761578
template <typename MapTy, typename ElemTy>
1577-
bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
1578-
const ElemTy &E2) {
1579+
static bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
1580+
const ElemTy &E2) {
15791581
auto E1Iterator = Map.find(E1);
15801582
auto E2Iterator = Map.find(E2);
15811583
if (E1Iterator == Map.end() || E2Iterator == Map.end())
@@ -1882,6 +1884,8 @@ static bool prefixSuffixCoverUnderThreshold(std::size_t Threshold,
18821884

18831885
} // namespace filter
18841886

1887+
namespace {
1888+
18851889
/// Matches functions that have at least the specified amount of parameters.
18861890
AST_MATCHER_P(FunctionDecl, parameterCountGE, unsigned, N) {
18871891
return Node.getNumParams() >= N;
@@ -1904,6 +1908,8 @@ AST_MATCHER(FunctionDecl, isOverloadedUnaryOrBinaryOperator) {
19041908
}
19051909
}
19061910

1911+
} // namespace
1912+
19071913
/// Returns the DefaultMinimumLength if the Value of requested minimum length
19081914
/// is less than 2. Minimum lengths of 0 or 1 are not accepted.
19091915
static inline unsigned clampMinimumLength(const unsigned Value) {

clang-tools-extra/clang-tidy/bugprone/IncDecInConditionsCheck.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ using namespace clang::ast_matchers;
1515

1616
namespace clang::tidy::bugprone {
1717

18+
namespace {
19+
1820
AST_MATCHER(BinaryOperator, isLogicalOperator) { return Node.isLogicalOp(); }
1921

2022
AST_MATCHER(UnaryOperator, isUnaryPrePostOperator) {
@@ -26,6 +28,8 @@ AST_MATCHER(CXXOperatorCallExpr, isPrePostOperator) {
2628
Node.getOperator() == OO_MinusMinus;
2729
}
2830

31+
} // namespace
32+
2933
void IncDecInConditionsCheck::registerMatchers(MatchFinder *Finder) {
3034
auto OperatorMatcher = expr(
3135
anyOf(binaryOperator(anyOf(isComparisonOperator(), isLogicalOperator())),

clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ bool isExprValueStored(const Expr *E, ASTContext &C) {
4949
return isa<CallExpr, CXXConstructExpr>(ParentE);
5050
}
5151

52-
} // namespace
53-
5452
AST_MATCHER_P(CXXTryStmt, hasHandlerFor,
5553
ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
5654
for (unsigned NH = Node.getNumHandlers(), I = 0; I < NH; ++I) {
@@ -74,6 +72,8 @@ AST_MATCHER(CXXNewExpr, mayThrow) {
7472
return !OperatorNew->getType()->castAs<FunctionProtoType>()->isNothrow();
7573
}
7674

75+
} // namespace
76+
7777
void MultipleNewInOneExpressionCheck::registerMatchers(MatchFinder *Finder) {
7878
auto BadAllocType =
7979
recordType(hasDeclaration(cxxRecordDecl(hasName("::std::bad_alloc"))));

clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ using ast_matchers::stmtExpr;
4646
using ast_matchers::unless;
4747
using ast_matchers::voidType;
4848

49-
const Expr *getCondition(const BoundNodes &Nodes, const StringRef NodeId) {
49+
static const Expr *getCondition(const BoundNodes &Nodes,
50+
const StringRef NodeId) {
5051
const auto *If = Nodes.getNodeAs<IfStmt>(NodeId);
5152
if (If != nullptr)
5253
return If->getCond();

clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ AST_MATCHER(clang::VarDecl, isDirectInitialization) {
3333

3434
} // namespace
3535

36-
RewriteRuleWith<std::string> stringviewNullptrCheckImpl() {
36+
static RewriteRuleWith<std::string> stringviewNullptrCheckImpl() {
3737
auto ConstructionWarning =
3838
cat("constructing basic_string_view from null is undefined; replace with "
3939
"the default constructor");

clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using namespace clang::ast_matchers;
1313

1414
namespace clang::tidy::bugprone {
15+
namespace {
1516

1617
AST_MATCHER_P(CXXTryStmt, hasHandlerFor,
1718
ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
@@ -36,6 +37,8 @@ AST_MATCHER(CXXNewExpr, mayThrow) {
3637
return !OperatorNew->getType()->castAs<FunctionProtoType>()->isNothrow();
3738
}
3839

40+
} // namespace
41+
3942
UnhandledExceptionAtNewCheck::UnhandledExceptionAtNewCheck(
4043
StringRef Name, ClangTidyContext *Context)
4144
: ClangTidyCheck(Name, Context) {}

clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) {
3737
}
3838

3939
template <typename T>
40-
void reportDiagnostic(DiagnosticBuilder D, const T *Node, SourceRange SR,
41-
bool DefaultConstruction) {
40+
static void reportDiagnostic(DiagnosticBuilder D, const T *Node, SourceRange SR,
41+
bool DefaultConstruction) {
4242
const char *Replacement = " give_me_a_name";
4343

4444
// If this is a default ctor we have to remove the parens or we'll introduce a

clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void UseAfterMoveFinder::getUsesAndReinits(
242242
});
243243
}
244244

245-
bool isStandardSmartPointer(const ValueDecl *VD) {
245+
static bool isStandardSmartPointer(const ValueDecl *VD) {
246246
const Type *TheType = VD->getType().getNonReferenceType().getTypePtrOrNull();
247247
if (!TheType)
248248
return false;

clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,6 @@ static ClangTidyModuleRegistry::Add<cert::CERTModule>
358358

359359
// This anchor is used to force the linker to link in the generated object file
360360
// and thus register the CERTModule.
361-
volatile int CERTModuleAnchorSource = 0;
361+
volatile int CERTModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
362362

363363
} // namespace clang::tidy

clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static ClangTidyModuleRegistry::Add<concurrency::ConcurrencyModule>
3434

3535
// This anchor is used to force the linker to link in the generated object file
3636
// and thus register the ConcurrencyModule.
37+
// NOLINTNEXTLINE(misc-use-internal-linkage)
3738
volatile int ConcurrencyModuleAnchorSource = 0;
3839

3940
} // namespace clang::tidy

clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule>
156156

157157
// This anchor is used to force the linker to link in the generated object file
158158
// and thus register the CppCoreGuidelinesModule.
159+
// NOLINTNEXTLINE(misc-use-internal-linkage)
159160
volatile int CppCoreGuidelinesModuleAnchorSource = 0;
160161

161162
} // namespace clang::tidy

clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ using namespace clang::ast_matchers;
1818

1919
namespace clang::tidy::cppcoreguidelines {
2020

21+
namespace {
22+
2123
AST_MATCHER(CXXRecordDecl, hasPublicVirtualOrProtectedNonVirtualDestructor) {
2224
// We need to call Node.getDestructor() instead of matching a
2325
// CXXDestructorDecl. Otherwise, tests will fail for class templates, since
@@ -33,6 +35,8 @@ AST_MATCHER(CXXRecordDecl, hasPublicVirtualOrProtectedNonVirtualDestructor) {
3335
!Destructor->isVirtual()));
3436
}
3537

38+
} // namespace
39+
3640
void VirtualClassDestructorCheck::registerMatchers(MatchFinder *Finder) {
3741
ast_matchers::internal::Matcher<CXXRecordDecl> InheritsVirtualMethod =
3842
hasAnyBase(hasType(cxxRecordDecl(has(cxxMethodDecl(isVirtual())))));

clang-tools-extra/clang-tidy/darwin/DarwinTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ static ClangTidyModuleRegistry::Add<darwin::DarwinModule>
3232

3333
// This anchor is used to force the linker to link in the generated object file
3434
// and thus register the DarwinModule.
35-
volatile int DarwinModuleAnchorSource = 0;
35+
volatile int DarwinModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
3636

3737
} // namespace clang::tidy

clang-tools-extra/clang-tidy/fuchsia/FuchsiaTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ static ClangTidyModuleRegistry::Add<FuchsiaModule>
5252

5353
// This anchor is used to force the linker to link in the generated object file
5454
// and thus register the FuchsiaModule.
55-
volatile int FuchsiaModuleAnchorSource = 0;
55+
volatile int FuchsiaModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
5656

5757
} // namespace clang::tidy

clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
100100

101101
// This anchor is used to force the linker to link in the generated object file
102102
// and thus register the GoogleModule.
103-
volatile int GoogleModuleAnchorSource = 0;
103+
volatile int GoogleModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
104104

105105
} // namespace clang::tidy

clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ static ClangTidyModuleRegistry::Add<HICPPModule>
119119

120120
// This anchor is used to force the linker to link in the generated object file
121121
// and thus register the HICPPModule.
122-
volatile int HICPPModuleAnchorSource = 0;
122+
volatile int HICPPModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
123123

124124
} // namespace clang::tidy

clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static ClangTidyModuleRegistry::Add<LinuxKernelModule>
3030

3131
// This anchor is used to force the linker to link in the generated object file
3232
// and thus register the LinuxKernelModule.
33+
// NOLINTNEXTLINE(misc-use-internal-linkage)
3334
volatile int LinuxKernelModuleAnchorSource = 0;
3435

3536
} // namespace clang::tidy

clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ static ClangTidyModuleRegistry::Add<LLVMModule> X("llvm-module",
5757

5858
// This anchor is used to force the linker to link in the generated object file
5959
// and thus register the LLVMModule.
60-
volatile int LLVMModuleAnchorSource = 0;
60+
volatile int LLVMModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
6161

6262
} // namespace clang::tidy

clang-tools-extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414

1515
using namespace clang::ast_matchers;
1616

17-
namespace clang {
18-
namespace ast_matchers {
19-
AST_MATCHER(Expr, isMacroID) { return Node.getExprLoc().isMacroID(); }
20-
} // namespace ast_matchers
17+
namespace clang::tidy::llvm_check {
2118

22-
namespace tidy::llvm_check {
19+
namespace {
20+
AST_MATCHER(Expr, isMacroID) { return Node.getExprLoc().isMacroID(); }
21+
} // namespace
2322

2423
void PreferIsaOrDynCastInConditionalsCheck::registerMatchers(
2524
MatchFinder *Finder) {
@@ -125,5 +124,4 @@ void PreferIsaOrDynCastInConditionalsCheck::check(
125124
}
126125
}
127126

128-
} // namespace tidy::llvm_check
129-
} // namespace clang
127+
} // namespace clang::tidy::llvm_check

clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace clang::tidy::llvm_libc {
1919

2020
// Gets the outermost namespace of a DeclContext, right under the Translation
2121
// Unit.
22-
const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
22+
static const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
2323
const DeclContext *Parent = Decl->getParent();
2424
if (Parent->isTranslationUnit())
2525
return Decl;

clang-tools-extra/clang-tidy/llvmlibc/LLVMLibcTidyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static ClangTidyModuleRegistry::Add<LLVMLibcModule>
3939

4040
// This anchor is used to force the linker to link in the generated object file
4141
// and thus register the LLVMLibcModule.
42+
// NOLINTNEXTLINE(misc-use-internal-linkage)
4243
volatile int LLVMLibcModuleAnchorSource = 0;
4344

4445
} // namespace clang::tidy

clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ static ClangTidyModuleRegistry::Add<misc::MiscModule>
9292

9393
// This anchor is used to force the linker to link in the generated object file
9494
// and thus register the MiscModule.
95-
volatile int MiscModuleAnchorSource = 0;
95+
volatile int MiscModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
9696

9797
} // namespace clang::tidy

0 commit comments

Comments
 (0)