Skip to content

Commit ce46adb

Browse files
authored
[clang-tidy][NFC] run clang-format over 'android', 'boost' and 'bugprone' checks (llvm#143315)
1 parent 65d6662 commit ce46adb

28 files changed

+88
-91
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ namespace android {
3434
class AndroidModule : public ClangTidyModule {
3535
public:
3636
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
37-
CheckFactories.registerCheck<CloexecAccept4Check>("android-cloexec-accept4");
37+
CheckFactories.registerCheck<CloexecAccept4Check>(
38+
"android-cloexec-accept4");
3839
CheckFactories.registerCheck<CloexecAcceptCheck>("android-cloexec-accept");
3940
CheckFactories.registerCheck<CloexecCreatCheck>("android-cloexec-creat");
4041
CheckFactories.registerCheck<CloexecDupCheck>("android-cloexec-dup");

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ void CloexecAcceptCheck::registerMatchers(MatchFinder *Finder) {
2626
}
2727

2828
void CloexecAcceptCheck::check(const MatchFinder::MatchResult &Result) {
29-
std::string ReplacementText =
30-
(Twine("accept4(") + getSpellingArg(Result, 0) + ", " +
31-
getSpellingArg(Result, 1) + ", " + getSpellingArg(Result, 2) +
32-
", SOCK_CLOEXEC)")
33-
.str();
29+
std::string ReplacementText = (Twine("accept4(") + getSpellingArg(Result, 0) +
30+
", " + getSpellingArg(Result, 1) + ", " +
31+
getSpellingArg(Result, 2) + ", SOCK_CLOEXEC)")
32+
.str();
3433

3534
replaceFunc(
3635
Result,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ std::string buildFixMsgForStringFlag(const Expr *Arg, const SourceManager &SM,
3636

3737
const char *CloexecCheck::FuncDeclBindingStr = "funcDecl";
3838

39-
const char *CloexecCheck::FuncBindingStr ="func";
39+
const char *CloexecCheck::FuncBindingStr = "func";
4040

4141
void CloexecCheck::registerMatchersImpl(
4242
MatchFinder *Finder, internal::Matcher<FunctionDecl> Function) {

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ namespace clang::tidy::android {
1616
void CloexecCreatCheck::registerMatchers(MatchFinder *Finder) {
1717
auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
1818
auto MODETType = hasType(namedDecl(hasName("mode_t")));
19-
registerMatchersImpl(Finder,
20-
functionDecl(isExternC(), returns(isInteger()),
21-
hasName("creat"),
22-
hasParameter(0, CharPointerType),
23-
hasParameter(1, MODETType)));
19+
registerMatchersImpl(Finder, functionDecl(isExternC(), returns(isInteger()),
20+
hasName("creat"),
21+
hasParameter(0, CharPointerType),
22+
hasParameter(1, MODETType)));
2423
}
2524

2625
void CloexecCreatCheck::check(const MatchFinder::MatchResult &Result) {

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ namespace clang::tidy::android {
1515

1616
void CloexecFopenCheck::registerMatchers(MatchFinder *Finder) {
1717
auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
18-
registerMatchersImpl(Finder,
19-
functionDecl(isExternC(), returns(asString("FILE *")),
20-
hasName("fopen"),
21-
hasParameter(0, CharPointerType),
22-
hasParameter(1, CharPointerType)));
18+
registerMatchersImpl(
19+
Finder, functionDecl(isExternC(), returns(asString("FILE *")),
20+
hasName("fopen"), hasParameter(0, CharPointerType),
21+
hasParameter(1, CharPointerType)));
2322
}
2423

2524
void CloexecFopenCheck::check(const MatchFinder::MatchResult &Result) {

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ void CloexecOpenCheck::registerMatchers(MatchFinder *Finder) {
2020
hasAnyName("open", "open64"),
2121
hasParameter(0, CharPointerType),
2222
hasParameter(1, hasType(isInteger()))));
23-
registerMatchersImpl(Finder,
24-
functionDecl(isExternC(), returns(isInteger()),
25-
hasName("openat"),
26-
hasParameter(0, hasType(isInteger())),
27-
hasParameter(1, CharPointerType),
28-
hasParameter(2, hasType(isInteger()))));
23+
registerMatchersImpl(
24+
Finder, functionDecl(isExternC(), returns(isInteger()), hasName("openat"),
25+
hasParameter(0, hasType(isInteger())),
26+
hasParameter(1, CharPointerType),
27+
hasParameter(2, hasType(isInteger()))));
2928
}
3029

3130
void CloexecOpenCheck::check(const MatchFinder::MatchResult &Result) {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ using namespace clang::ast_matchers;
1414
namespace clang::tidy::android {
1515

1616
void CloexecPipe2Check::registerMatchers(MatchFinder *Finder) {
17-
registerMatchersImpl(Finder,
18-
functionDecl(returns(isInteger()), hasName("pipe2"),
19-
hasParameter(0, hasType(pointsTo(isInteger()))),
20-
hasParameter(1, hasType(isInteger()))));
17+
registerMatchersImpl(
18+
Finder, functionDecl(returns(isInteger()), hasName("pipe2"),
19+
hasParameter(0, hasType(pointsTo(isInteger()))),
20+
hasParameter(1, hasType(isInteger()))));
2121
}
2222

2323
void CloexecPipe2Check::check(const MatchFinder::MatchResult &Result) {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ using namespace clang::ast_matchers;
1414
namespace clang::tidy::android {
1515

1616
void CloexecPipeCheck::registerMatchers(MatchFinder *Finder) {
17-
registerMatchersImpl(Finder,
18-
functionDecl(returns(isInteger()), hasName("pipe"),
19-
hasParameter(0, hasType(pointsTo(isInteger())))));
17+
registerMatchersImpl(
18+
Finder, functionDecl(returns(isInteger()), hasName("pipe"),
19+
hasParameter(0, hasType(pointsTo(isInteger())))));
2020
}
2121

2222
void CloexecPipeCheck::check(const MatchFinder::MatchResult &Result) {
2323
std::string ReplacementText =
2424
(Twine("pipe2(") + getSpellingArg(Result, 0) + ", O_CLOEXEC)").str();
2525

26-
replaceFunc(
27-
Result,
28-
"prefer pipe2() with O_CLOEXEC to avoid leaking file descriptors to child processes",
29-
ReplacementText);
26+
replaceFunc(Result,
27+
"prefer pipe2() with O_CLOEXEC to avoid leaking file descriptors "
28+
"to child processes",
29+
ReplacementText);
3030
}
3131

3232
} // namespace clang::tidy::android

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ using namespace clang::ast_matchers;
1414
namespace clang::tidy::android {
1515

1616
void CloexecSocketCheck::registerMatchers(MatchFinder *Finder) {
17-
registerMatchersImpl(Finder,
18-
functionDecl(isExternC(), returns(isInteger()),
19-
hasName("socket"),
20-
hasParameter(0, hasType(isInteger())),
21-
hasParameter(1, hasType(isInteger())),
22-
hasParameter(2, hasType(isInteger()))));
17+
registerMatchersImpl(
18+
Finder, functionDecl(isExternC(), returns(isInteger()), hasName("socket"),
19+
hasParameter(0, hasType(isInteger())),
20+
hasParameter(1, hasType(isInteger())),
21+
hasParameter(2, hasType(isInteger()))));
2322
}
2423

2524
void CloexecSocketCheck::check(const MatchFinder::MatchResult &Result) {

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
3636
this);
3737
}
3838

39-
void DynamicStaticInitializersCheck::check(const MatchFinder::MatchResult &Result) {
39+
void DynamicStaticInitializersCheck::check(
40+
const MatchFinder::MatchResult &Result) {
4041
const auto *Var = Result.Nodes.getNodeAs<VarDecl>("var");
4142
SourceLocation Loc = Var->getLocation();
42-
if (!Loc.isValid() || !utils::isPresumedLocInHeaderFile(Loc, *Result.SourceManager,
43-
HeaderFileExtensions))
43+
if (!Loc.isValid() || !utils::isPresumedLocInHeaderFile(
44+
Loc, *Result.SourceManager, HeaderFileExtensions))
4445
return;
4546
// If the initializer is a constant expression, then the compiler
4647
// doesn't have to dynamically initialize it.
47-
diag(Loc, "static variable %0 may be dynamically initialized in this header file")
48-
<< Var;
48+
diag(Loc,
49+
"static variable %0 may be dynamically initialized in this header file")
50+
<< Var;
4951
}
5052

5153
} // namespace clang::tidy::bugprone

0 commit comments

Comments
 (0)