summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy')
-rw-r--r--clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp b/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
index 1426dbbc09b..6b8763810e9 100644
--- a/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
@@ -26,15 +26,18 @@ RewriteRule invertIf() {
using tooling::change;
using tooling::node;
using tooling::statement;
+ using tooling::text;
using tooling::stencil::cat;
StringRef C = "C", T = "T", E = "E";
- return tooling::makeRule(ifStmt(hasCondition(expr().bind(C)),
- hasThen(stmt().bind(T)),
- hasElse(stmt().bind(E))),
- change(statement(RewriteRule::RootID),
- cat("if(!(", node(C), ")) ", statement(E),
- " else ", statement(T))));
+ RewriteRule Rule = tooling::makeRule(
+ ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)),
+ hasElse(stmt().bind(E))),
+ change(
+ statement(RewriteRule::RootID),
+ cat("if(!(", node(C), ")) ", statement(E), " else ", statement(T))),
+ text("negate condition and reverse `then` and `else` branches"));
+ return Rule;
}
class IfInverterCheck : public TransformerClangTidyCheck {
OpenPOWER on IntegriCloud