diff options
author | Alexander Kornienko <alexfh@google.com> | 2018-11-25 02:41:01 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2018-11-25 02:41:01 +0000 |
commit | 2e0ee616b96fa2ec09e5e2cae185b444c34ee482 (patch) | |
tree | f10294cd01ba13031b2944b527c28e84d4c0c9a0 /clang-tidy/fuchsia | |
parent | d9fc15699e52eb02ead015f701fe4234ab3570e6 (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/fuchsia')
-rw-r--r-- | clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp | 23 | ||||
-rw-r--r-- | clang-tidy/fuchsia/TrailingReturnCheck.cpp | 6 |
2 files changed, 14 insertions, 15 deletions
diff --git a/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp b/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp index e33f90ac..c8ffd2e5 100644 --- a/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp +++ b/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp @@ -34,18 +34,17 @@ void StaticallyConstructedObjectsCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus11) return; - Finder->addMatcher( - varDecl(allOf( - // Match global, statically stored objects... - isGlobalStatic(), - // ... that have C++ constructors... - hasDescendant(cxxConstructExpr(unless(allOf( - // ... unless it is constexpr ... - hasDeclaration(cxxConstructorDecl(isConstexpr())), - // ... and is statically initialized. - isConstantInitializer())))))) - .bind("decl"), - this); + Finder->addMatcher(varDecl( + // Match global, statically stored objects... + isGlobalStatic(), + // ... that have C++ constructors... + hasDescendant(cxxConstructExpr(unless(allOf( + // ... unless it is constexpr ... + hasDeclaration(cxxConstructorDecl(isConstexpr())), + // ... and is statically initialized. + isConstantInitializer()))))) + .bind("decl"), + this); } void StaticallyConstructedObjectsCheck::check( diff --git a/clang-tidy/fuchsia/TrailingReturnCheck.cpp b/clang-tidy/fuchsia/TrailingReturnCheck.cpp index 4ffa3f79..71dc4724 100644 --- a/clang-tidy/fuchsia/TrailingReturnCheck.cpp +++ b/clang-tidy/fuchsia/TrailingReturnCheck.cpp @@ -34,9 +34,9 @@ void TrailingReturnCheck::registerMatchers(MatchFinder *Finder) { // using decltype specifiers and lambda with otherwise unutterable // return types. Finder->addMatcher( - functionDecl(allOf(hasTrailingReturn(), - unless(anyOf(returns(decltypeType()), - hasParent(cxxRecordDecl(isLambda())))))) + functionDecl(hasTrailingReturn(), + unless(anyOf(returns(decltypeType()), + hasParent(cxxRecordDecl(isLambda()))))) .bind("decl"), this); } |