aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/readability
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2018-11-25 02:41:01 +0000
committerAlexander Kornienko <alexfh@google.com>2018-11-25 02:41:01 +0000
commit2e0ee616b96fa2ec09e5e2cae185b444c34ee482 (patch)
treef10294cd01ba13031b2944b527c28e84d4c0c9a0 /clang-tidy/readability
parentd9fc15699e52eb02ead015f701fe4234ab3570e6 (diff)
A bit of AST matcher cleanup, NFC.
Removed the uses of the allOf() matcher inside node matchers that are implicit allOf(). Replaced uses of allOf() with the explicit node matcher where it makes matchers more readable. Replace anyOf(hasName(), hasName(), ...) with the more efficient and readable hasAnyName(). git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@347520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/readability')
-rw-r--r--clang-tidy/readability/IsolateDeclarationCheck.cpp9
-rw-r--r--clang-tidy/readability/SimplifyBooleanExprCheck.cpp10
-rw-r--r--clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp10
3 files changed, 14 insertions, 15 deletions
diff --git a/clang-tidy/readability/IsolateDeclarationCheck.cpp b/clang-tidy/readability/IsolateDeclarationCheck.cpp
index 3155be39..e9ccb17b 100644
--- a/clang-tidy/readability/IsolateDeclarationCheck.cpp
+++ b/clang-tidy/readability/IsolateDeclarationCheck.cpp
@@ -26,11 +26,10 @@ AST_MATCHER(DeclStmt, onlyDeclaresVariables) {
} // namespace
void IsolateDeclarationCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(
- declStmt(allOf(onlyDeclaresVariables(), unless(isSingleDecl()),
- hasParent(compoundStmt())))
- .bind("decl_stmt"),
- this);
+ Finder->addMatcher(declStmt(onlyDeclaresVariables(), unless(isSingleDecl()),
+ hasParent(compoundStmt()))
+ .bind("decl_stmt"),
+ this);
}
static SourceLocation findStartOfIndirection(SourceLocation Start,
diff --git a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
index 3cb26532..b565a5fe 100644
--- a/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ b/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -491,12 +491,12 @@ void SimplifyBooleanExprCheck::matchCompoundIfReturnsBool(MatchFinder *Finder,
bool Value,
StringRef Id) {
Finder->addMatcher(
- compoundStmt(allOf(hasAnySubstatement(ifStmt(hasThen(returnsBool(Value)),
- unless(hasElse(stmt())))),
- hasAnySubstatement(
- returnStmt(has(ignoringParenImpCasts(
+ compoundStmt(
+ hasAnySubstatement(
+ ifStmt(hasThen(returnsBool(Value)), unless(hasElse(stmt())))),
+ hasAnySubstatement(returnStmt(has(ignoringParenImpCasts(
cxxBoolLiteral(equals(!Value)))))
- .bind(CompoundReturnId))))
+ .bind(CompoundReturnId)))
.bind(Id),
this);
}
diff --git a/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp b/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
index 18eeb9eb..eeaece11 100644
--- a/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
+++ b/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
@@ -196,11 +196,11 @@ void UppercaseLiteralSuffixCheck::registerMatchers(MatchFinder *Finder) {
// E.g. i32 suffix still results in 'BuiltinType::Kind::Int'.
// And such an info is not stored in the *Literal itself.
Finder->addMatcher(
- stmt(allOf(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
- floatLiteral().bind(FloatingLiteralCheck::Name)),
- unless(anyOf(hasParent(userDefinedLiteral()),
- hasAncestor(isImplicit()),
- hasAncestor(substNonTypeTemplateParmExpr()))))),
+ stmt(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
+ floatLiteral().bind(FloatingLiteralCheck::Name)),
+ unless(anyOf(hasParent(userDefinedLiteral()),
+ hasAncestor(isImplicit()),
+ hasAncestor(substNonTypeTemplateParmExpr())))),
this);
}