Skip to content

Commit fbd14bc

Browse files
vbvictortomtor
authored andcommitted
[clang-tidy][NFC] fix 'misc-use-internal-linkage' check warnings (llvm#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 23a581c commit fbd14bc

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),

0 commit comments

Comments
 (0)