diff options
author | Stephen Kelly <steveire@gmail.com> | 2021-01-02 21:18:29 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2021-02-03 23:21:17 +0000 |
commit | c0199b2a21705747c999a59bfa77d7fc6e4500a5 (patch) | |
tree | 3eb505feb2b5641a88098c5b227b9fbf870ab36d /clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp | |
parent | 1f06f41993b6363e6b2c4f22a13488a3e687f31b (diff) | |
download | llvm-c0199b2a21705747c999a59bfa77d7fc6e4500a5.zip llvm-c0199b2a21705747c999a59bfa77d7fc6e4500a5.tar.gz llvm-c0199b2a21705747c999a59bfa77d7fc6e4500a5.tar.bz2 |
[clang-tidy] Use new mapping matchers
Use mapAnyOf() and matchers based on it.
Use of binaryOperation() means that modernize-loop-convert and
readability-container-size-empty can now be used with rewritten binary
operators.
Differential Revision: https://reviews.llvm.org/D94131
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp index bd1d8c3..9e336cb 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp @@ -37,11 +37,10 @@ void RedundantControlFlowCheck::registerMatchers(MatchFinder *Finder) { has(compoundStmt(hasAnySubstatement(returnStmt(unless(has(expr()))))) .bind("return"))), this); - auto CompoundContinue = - has(compoundStmt(hasAnySubstatement(continueStmt())).bind("continue")); Finder->addMatcher( - stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()), - CompoundContinue), + mapAnyOf(forStmt, cxxForRangeStmt, whileStmt, doStmt) + .with(hasBody(compoundStmt(hasAnySubstatement(continueStmt())) + .bind("continue"))), this); } |