Skip to content

Commit f89df3a

Browse files
authored
Merge pull request #35 from sx-aurora-dev/feature/merge-upstream-20210212
Feature/merge upstream 20210212
2 parents dd4dc47 + c4d48f1 commit f89df3a

File tree

3,893 files changed

+140018
-82681
lines changed

Some content is hidden

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

3,893 files changed

+140018
-82681
lines changed

clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ SymbolIndexManager::search(llvm::StringRef Identifier,
149149
rank(MatchedSymbols, FileName);
150150
// Strip signals, they are no longer needed.
151151
std::vector<SymbolInfo> Res;
152+
Res.reserve(MatchedSymbols.size());
152153
for (auto &SymAndSig : MatchedSymbols)
153154
Res.push_back(std::move(SymAndSig.Symbol));
154155
return Res;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace bugprone {
2121

2222
static internal::Matcher<Stmt>
2323
loopEndingStmt(internal::Matcher<Stmt> Internal) {
24-
return stmt(anyOf(breakStmt(Internal), returnStmt(Internal),
25-
gotoStmt(Internal), cxxThrowExpr(Internal),
26-
callExpr(Internal, callee(functionDecl(isNoReturn())))));
24+
return stmt(anyOf(
25+
mapAnyOf(breakStmt, returnStmt, gotoStmt, cxxThrowExpr).with(Internal),
26+
callExpr(Internal, callee(functionDecl(isNoReturn())))));
2727
}
2828

2929
/// Return whether `Var` was changed in `LoopStmt`.
@@ -122,8 +122,8 @@ void InfiniteLoopCheck::registerMatchers(MatchFinder *Finder) {
122122
unless(hasBody(hasDescendant(
123123
loopEndingStmt(forFunction(equalsBoundNode("func")))))));
124124

125-
Finder->addMatcher(stmt(anyOf(whileStmt(LoopCondition), doStmt(LoopCondition),
126-
forStmt(LoopCondition)))
125+
Finder->addMatcher(mapAnyOf(whileStmt, doStmt, forStmt)
126+
.with(LoopCondition)
127127
.bind("loop-stmt"),
128128
this);
129129
}

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,20 @@ void SpuriouslyWakeUpFunctionsCheck::registerMatchers(MatchFinder *Finder) {
5959
if (getLangOpts().CPlusPlus) {
6060
// Check for `CON54-CPP`
6161
Finder->addMatcher(
62-
ifStmt(
63-
allOf(HasWaitDescendantCpp,
64-
unless(anyOf(hasDescendant(ifStmt(HasWaitDescendantCpp)),
65-
hasDescendant(whileStmt(HasWaitDescendantCpp)),
66-
hasDescendant(forStmt(HasWaitDescendantCpp)),
67-
hasDescendant(doStmt(HasWaitDescendantCpp)))))
68-
69-
),
62+
ifStmt(HasWaitDescendantCpp,
63+
unless(hasDescendant(mapAnyOf(ifStmt, whileStmt, forStmt, doStmt)
64+
.with(HasWaitDescendantCpp)))),
7065
this);
7166
} else {
7267
// Check for `CON36-C`
7368
Finder->addMatcher(
74-
ifStmt(
75-
allOf(HasWaitDescendantC,
76-
unless(anyOf(hasDescendant(ifStmt(HasWaitDescendantC)),
77-
hasDescendant(whileStmt(HasWaitDescendantC)),
78-
hasDescendant(forStmt(HasWaitDescendantC)),
79-
hasDescendant(doStmt(HasWaitDescendantC)),
80-
hasParent(whileStmt()),
81-
hasParent(compoundStmt(hasParent(whileStmt()))),
82-
hasParent(forStmt()),
83-
hasParent(compoundStmt(hasParent(forStmt()))),
84-
hasParent(doStmt()),
85-
hasParent(compoundStmt(hasParent(doStmt())))))
86-
87-
))
88-
89-
,
69+
ifStmt(HasWaitDescendantC,
70+
unless(anyOf(
71+
hasDescendant(mapAnyOf(ifStmt, whileStmt, forStmt, doStmt)
72+
.with(HasWaitDescendantC)),
73+
hasParent(mapAnyOf(whileStmt, forStmt, doStmt)),
74+
hasParent(compoundStmt(
75+
hasParent(mapAnyOf(whileStmt, forStmt, doStmt))))))),
9076
this);
9177
}
9278
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ void SuspiciousStringCompareCheck::registerMatchers(MatchFinder *Finder) {
113113
// Detect suspicious calls to string compare:
114114
// 'if (strcmp())' -> 'if (strcmp() != 0)'
115115
Finder->addMatcher(
116-
stmt(anyOf(ifStmt(hasCondition(StringCompareCallExpr)),
117-
whileStmt(hasCondition(StringCompareCallExpr)),
118-
doStmt(hasCondition(StringCompareCallExpr)),
119-
forStmt(hasCondition(StringCompareCallExpr)),
116+
stmt(anyOf(mapAnyOf(ifStmt, whileStmt, doStmt, forStmt)
117+
.with(hasCondition(StringCompareCallExpr)),
120118
binaryOperator(hasAnyOperatorName("&&", "||"),
121119
hasEitherOperand(StringCompareCallExpr))))
122120
.bind("missing-comparison"),

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,9 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) {
4040

4141
// Self-check: Code compares something with 'this' pointer. We don't check
4242
// whether it is actually the parameter what we compare.
43-
const auto HasNoSelfCheck = cxxMethodDecl(unless(anyOf(
44-
hasDescendant(binaryOperator(hasAnyOperatorName("==", "!="),
45-
has(ignoringParenCasts(cxxThisExpr())))),
46-
hasDescendant(cxxOperatorCallExpr(
47-
hasAnyOverloadedOperatorName("==", "!="), argumentCountIs(2),
48-
has(ignoringParenCasts(cxxThisExpr())))))));
43+
const auto HasNoSelfCheck = cxxMethodDecl(unless(hasDescendant(
44+
binaryOperation(hasAnyOperatorName("==", "!="),
45+
hasEitherOperand(ignoringParenCasts(cxxThisExpr()))))));
4946

5047
// Both copy-and-swap and copy-and-move method creates a copy first and
5148
// assign it to 'this' with swap or move.

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,7 @@ void UseAfterMoveFinder::getReinits(
310310
// Assignment. In addition to the overloaded assignment operator,
311311
// test for built-in assignment as well, since template functions
312312
// may be instantiated to use std::move() on built-in types.
313-
binaryOperator(hasOperatorName("="), hasLHS(DeclRefMatcher)),
314-
cxxOperatorCallExpr(hasOverloadedOperatorName("="),
315-
hasArgument(0, DeclRefMatcher)),
313+
binaryOperation(hasOperatorName("="), hasLHS(DeclRefMatcher)),
316314
// Declaration. We treat this as a type of reinitialization too,
317315
// so we don't need to treat it separately.
318316
declStmt(hasDescendant(equalsNode(MovedVariable))),

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,16 @@ void MutatingCopyCheck::registerMatchers(MatchFinder *Finder) {
3030
MemberExprOrSourceObject);
3131

3232
const auto IsSourceMutatingAssignment = traverse(
33-
TK_AsIs,
34-
expr(anyOf(binaryOperator(isAssignmentOperator(), hasLHS(IsPartOfSource))
35-
.bind(MutatingOperatorName),
36-
cxxOperatorCallExpr(isAssignmentOperator(),
37-
hasArgument(0, IsPartOfSource))
38-
.bind(MutatingOperatorName))));
33+
TK_AsIs, binaryOperation(hasOperatorName("="), hasLHS(IsPartOfSource))
34+
.bind(MutatingOperatorName));
3935

4036
const auto MemberExprOrSelf = anyOf(memberExpr(), cxxThisExpr());
4137

4238
const auto IsPartOfSelf = allOf(
4339
unless(hasDescendant(expr(unless(MemberExprOrSelf)))), MemberExprOrSelf);
4440

4541
const auto IsSelfMutatingAssignment =
46-
expr(anyOf(binaryOperator(isAssignmentOperator(), hasLHS(IsPartOfSelf)),
47-
cxxOperatorCallExpr(isAssignmentOperator(),
48-
hasArgument(0, IsPartOfSelf))));
42+
binaryOperation(isAssignmentOperator(), hasLHS(IsPartOfSelf));
4943

5044
const auto IsSelfMutatingMemberFunction =
5145
functionDecl(hasBody(hasDescendant(IsSelfMutatingAssignment)));

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ void AvoidGotoCheck::registerMatchers(MatchFinder *Finder) {
2929

3030
// Check if the 'goto' is used for control flow other than jumping
3131
// out of a nested loop.
32-
auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
33-
auto NestedLoop =
34-
stmt(anyOf(forStmt(hasAncestor(Loop)), cxxForRangeStmt(hasAncestor(Loop)),
35-
whileStmt(hasAncestor(Loop)), doStmt(hasAncestor(Loop))));
32+
auto Loop = mapAnyOf(forStmt, cxxForRangeStmt, whileStmt, doStmt);
33+
auto NestedLoop = Loop.with(hasAncestor(Loop));
3634

3735
Finder->addMatcher(gotoStmt(anyOf(unless(hasAncestor(NestedLoop)),
3836
unless(isForwardJumping())))

clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace google {
1717
namespace readability {
1818

1919
// Check for underscores in the names of googletest tests, per
20-
// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
20+
// https://github.com/google/googletest/blob/master/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
2121
///
2222
/// For the user-facing documentation see:
2323
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-avoid-underscore-in-googletest-name.html

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ void PreferIsaOrDynCastInConditionalsCheck::registerMatchers(
4747
allOf(callee(namedDecl(hasAnyName("isa", "cast", "cast_or_null",
4848
"dyn_cast", "dyn_cast_or_null"))
4949
.bind("func")),
50-
hasArgument(0, anyOf(declRefExpr().bind("arg"),
51-
cxxMemberCallExpr().bind("arg"))))))
50+
hasArgument(
51+
0,
52+
mapAnyOf(declRefExpr, cxxMemberCallExpr).bind("arg")))))
5253
.bind("rhs");
5354

5455
Finder->addMatcher(

0 commit comments

Comments
 (0)