Skip to content

Commit 21511df

Browse files
rebased
Created using spr 1.3.7
2 parents d0830ec + ae4289f commit 21511df

File tree

493 files changed

+17202
-8913
lines changed

Some content is hidden

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

493 files changed

+17202
-8913
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ Checks: >
3232
-readability-qualified-auto,
3333
-readability-simplify-boolean-expr,
3434
-readability-static-definition-in-anonymous-namespace,
35-
-readability-suspicious-call-argument,
36-
-readability-use-anyofallof
35+
-readability-suspicious-call-argument
3736
3837
CheckOptions:
3938
- key: performance-move-const-arg.CheckTriviallyCopyableMove

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,10 @@ bool ClangTidyDiagnosticConsumer::passesLineFilter(StringRef FileName,
478478
if (FileName.ends_with(Filter.Name)) {
479479
if (Filter.LineRanges.empty())
480480
return true;
481-
for (const FileFilter::LineRange &Range : Filter.LineRanges) {
482-
if (Range.first <= LineNumber && LineNumber <= Range.second)
483-
return true;
484-
}
485-
return false;
481+
return llvm::any_of(
482+
Filter.LineRanges, [&](const FileFilter::LineRange &Range) {
483+
return Range.first <= LineNumber && LineNumber <= Range.second;
484+
});
486485
}
487486
}
488487
return false;

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ExpandModularHeadersPPCallbacks : public PPCallbacks {
137137
std::unique_ptr<Preprocessor> PP;
138138
bool EnteredMainFile = false;
139139
bool StartedLexing = false;
140-
Token CurrentToken;
140+
Token CurrentToken = Token();
141141
};
142142

143143
} // namespace tooling

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,9 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
7575
if (!S)
7676
return true;
7777

78-
for (const Attr *A : S->getAttrs()) {
79-
if (isa<FallThroughAttr>(A))
80-
return false;
81-
}
82-
83-
return true;
78+
return llvm::all_of(S->getAttrs(), [](const Attr *A) {
79+
return !isa<FallThroughAttr>(A);
80+
});
8481
}
8582
} Visitor;
8683

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ AST_MATCHER(CXXRecordDecl, correctHandleCaptureThisLambda) {
4444
if (Node.hasSimpleMoveAssignment())
4545
return false;
4646

47-
for (const CXXConstructorDecl *C : Node.ctors()) {
48-
if (C->isCopyOrMoveConstructor() && C->isDefaulted() && !C->isDeleted())
49-
return false;
50-
}
51-
for (const CXXMethodDecl *M : Node.methods()) {
52-
if (M->isCopyAssignmentOperator())
53-
llvm::errs() << M->isDeleted() << "\n";
54-
if (M->isCopyAssignmentOperator() && M->isDefaulted() && !M->isDeleted())
55-
return false;
56-
if (M->isMoveAssignmentOperator() && M->isDefaulted() && !M->isDeleted())
57-
return false;
58-
}
47+
if (llvm::any_of(Node.ctors(), [](const CXXConstructorDecl *C) {
48+
return C->isCopyOrMoveConstructor() && C->isDefaulted() &&
49+
!C->isDeleted();
50+
}))
51+
return false;
52+
if (llvm::any_of(Node.methods(), [](const CXXMethodDecl *M) {
53+
return (M->isCopyAssignmentOperator() ||
54+
M->isMoveAssignmentOperator()) &&
55+
M->isDefaulted() && !M->isDeleted();
56+
}))
57+
return false;
5958
// FIXME: find ways to identifier correct handle capture this lambda
6059
return true;
6160
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,11 +1589,9 @@ static bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1,
15891589
if (E1Iterator == Map.end() || E2Iterator == Map.end())
15901590
return false;
15911591

1592-
for (const auto &E1SetElem : E1Iterator->second)
1593-
if (E2Iterator->second.contains(E1SetElem))
1594-
return true;
1595-
1596-
return false;
1592+
return llvm::any_of(E1Iterator->second, [&E2Iterator](const auto &E1SetElem) {
1593+
return E2Iterator->second.contains(E1SetElem);
1594+
});
15971595
}
15981596

15991597
/// Implements the heuristic that marks two parameters related if there is

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ void ExceptionEscapeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
7272

7373
void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
7474
auto MatchIf = [](bool Enabled, const auto &Matcher) {
75-
ast_matchers::internal::Matcher<FunctionDecl> Nothing = unless(anything());
75+
const ast_matchers::internal::Matcher<FunctionDecl> Nothing =
76+
unless(anything());
7677
return Enabled ? Matcher : Nothing;
7778
};
7879
Finder->addMatcher(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void FloatLoopCounterCheck::registerMatchers(MatchFinder *Finder) {
3131

3232
void FloatLoopCounterCheck::check(const MatchFinder::MatchResult &Result) {
3333
const auto *FS = Result.Nodes.getNodeAs<ForStmt>("for");
34+
assert(FS && "FS should not be null");
3435

3536
diag(FS->getInc()->getBeginLoc(), "loop induction expression should not have "
3637
"floating-point type")

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,9 @@ static bool isAtLeastOneCondVarChanged(const Decl *Func, const Stmt *LoopStmt,
119119
if (isVarThatIsPossiblyChanged(Func, LoopStmt, Cond, Context))
120120
return true;
121121

122-
for (const Stmt *Child : Cond->children()) {
123-
if (!Child)
124-
continue;
125-
126-
if (isAtLeastOneCondVarChanged(Func, LoopStmt, Child, Context))
127-
return true;
128-
}
129-
return false;
122+
return llvm::any_of(Cond->children(), [&](const Stmt *Child) {
123+
return Child && isAtLeastOneCondVarChanged(Func, LoopStmt, Child, Context);
124+
});
130125
}
131126

132127
/// Return the variable names in `Cond`.
@@ -240,10 +235,9 @@ static bool hasStaticLocalVariable(const Stmt *Cond) {
240235
return true;
241236
}
242237

243-
for (const Stmt *Child : Cond->children())
244-
if (Child && hasStaticLocalVariable(Child))
245-
return true;
246-
return false;
238+
return llvm::any_of(Cond->children(), [](const Stmt *Child) {
239+
return Child && hasStaticLocalVariable(Child);
240+
});
247241
}
248242

249243
/// Tests if the loop condition `Cond` involves static local variables and

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ class FindAssignToVarBefore
9292
return false;
9393
}
9494
bool VisitStmt(const Stmt *S) {
95-
for (const Stmt *Child : S->children())
96-
if (Child && Visit(Child))
97-
return true;
98-
return false;
95+
return llvm::any_of(S->children(), [this](const Stmt *Child) {
96+
return Child && Visit(Child);
97+
});
9998
}
10099
};
101100

0 commit comments

Comments
 (0)