[clang] a29fd4d - [libTooling] Fix indentation. NFC.
Eric Li via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 11:35:19 PDT 2022
Author: Eric Li
Date: 2022-03-28T18:34:45Z
New Revision: a29fd4d4dad3f4c62dbcb31bc097535620455208
URL: https://github.com/llvm/llvm-project/commit/a29fd4d4dad3f4c62dbcb31bc097535620455208
DIFF: https://github.com/llvm/llvm-project/commit/a29fd4d4dad3f4c62dbcb31bc097535620455208.diff
LOG: [libTooling] Fix indentation. NFC.
Added:
Modified:
clang/unittests/Tooling/TransformerTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp
index 75ba9b919bbf9..9bc372b97d807 100644
--- a/clang/unittests/Tooling/TransformerTest.cpp
+++ b/clang/unittests/Tooling/TransformerTest.cpp
@@ -82,7 +82,7 @@ static std::string format(StringRef Code) {
}
static void compareSnippets(StringRef Expected,
- const llvm::Optional<std::string> &MaybeActual) {
+ const llvm::Optional<std::string> &MaybeActual) {
ASSERT_TRUE(MaybeActual) << "Rewrite failed. Expecting: " << Expected;
auto Actual = *MaybeActual;
std::string HL = "#include \"header.h\"\n";
@@ -1265,31 +1265,29 @@ void testIt()
auto RewriteOutput =
CodePrefix + RangeLoop + LoopBody + RangeLoop + LoopBody + CodeSuffix;
- auto MatchedLoop = forStmt(
- has(declStmt(
- hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
- .bind("loopVar")))),
- has(binaryOperator(hasOperatorName("!="),
- hasLHS(ignoringImplicit(declRefExpr(
- to(varDecl(equalsBoundNode("loopVar")))))),
- hasRHS(expr().bind("upperBoundExpr")))),
- has(unaryOperator(hasOperatorName("++"),
- hasUnaryOperand(declRefExpr(
- to(varDecl(equalsBoundNode("loopVar"))))))
- .bind("incrementOp")));
+ auto MatchedLoop = forStmt(
+ has(declStmt(hasSingleDecl(
+ varDecl(hasInitializer(integerLiteral(equals(0)))).bind("loopVar")))),
+ has(binaryOperator(hasOperatorName("!="),
+ hasLHS(ignoringImplicit(declRefExpr(
+ to(varDecl(equalsBoundNode("loopVar")))))),
+ hasRHS(expr().bind("upperBoundExpr")))),
+ has(unaryOperator(hasOperatorName("++"),
+ hasUnaryOperand(declRefExpr(
+ to(varDecl(equalsBoundNode("loopVar"))))))
+ .bind("incrementOp")));
- auto RewriteRule =
- changeTo(transformer::enclose(node("loopVar"), node("incrementOp")),
- cat("auto ", name("loopVar"), " : boost::irange(",
- node("upperBoundExpr"), ")"));
-
- testRule(makeRule(traverse(TK_IgnoreUnlessSpelledInSource, MatchedLoop),
- RewriteRule),
- RewriteInput, RewriteOutput);
+ auto RewriteRule =
+ changeTo(transformer::enclose(node("loopVar"), node("incrementOp")),
+ cat("auto ", name("loopVar"), " : boost::irange(",
+ node("upperBoundExpr"), ")"));
- testRuleFailure(makeRule(traverse(TK_AsIs, MatchedLoop), RewriteRule),
- RewriteInput);
+ testRule(makeRule(traverse(TK_IgnoreUnlessSpelledInSource, MatchedLoop),
+ RewriteRule),
+ RewriteInput, RewriteOutput);
+ testRuleFailure(makeRule(traverse(TK_AsIs, MatchedLoop), RewriteRule),
+ RewriteInput);
}
TEST_F(TransformerTest, ImplicitNodes_ForStmt2) {
@@ -1338,31 +1336,29 @@ void testIt()
auto RewriteOutput =
CodePrefix + RangeLoop + LoopBody + RangeLoop + LoopBody + CodeSuffix;
- auto MatchedLoop = forStmt(
- hasLoopInit(declStmt(
- hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
- .bind("loopVar")))),
- hasCondition(binaryOperator(hasOperatorName("!="),
- hasLHS(ignoringImplicit(declRefExpr(to(
- varDecl(equalsBoundNode("loopVar")))))),
- hasRHS(expr().bind("upperBoundExpr")))),
- hasIncrement(unaryOperator(hasOperatorName("++"),
- hasUnaryOperand(declRefExpr(to(
- varDecl(equalsBoundNode("loopVar"))))))
- .bind("incrementOp")));
-
- auto RewriteRule =
- changeTo(transformer::enclose(node("loopVar"), node("incrementOp")),
- cat("auto ", name("loopVar"), " : boost::irange(",
- node("upperBoundExpr"), ")"));
-
- testRule(makeRule(traverse(TK_IgnoreUnlessSpelledInSource, MatchedLoop),
- RewriteRule),
- RewriteInput, RewriteOutput);
-
- testRuleFailure(makeRule(traverse(TK_AsIs, MatchedLoop), RewriteRule),
- RewriteInput);
+ auto MatchedLoop = forStmt(
+ hasLoopInit(declStmt(hasSingleDecl(
+ varDecl(hasInitializer(integerLiteral(equals(0)))).bind("loopVar")))),
+ hasCondition(binaryOperator(hasOperatorName("!="),
+ hasLHS(ignoringImplicit(declRefExpr(to(
+ varDecl(equalsBoundNode("loopVar")))))),
+ hasRHS(expr().bind("upperBoundExpr")))),
+ hasIncrement(unaryOperator(hasOperatorName("++"),
+ hasUnaryOperand(declRefExpr(
+ to(varDecl(equalsBoundNode("loopVar"))))))
+ .bind("incrementOp")));
+
+ auto RewriteRule =
+ changeTo(transformer::enclose(node("loopVar"), node("incrementOp")),
+ cat("auto ", name("loopVar"), " : boost::irange(",
+ node("upperBoundExpr"), ")"));
+
+ testRule(makeRule(traverse(TK_IgnoreUnlessSpelledInSource, MatchedLoop),
+ RewriteRule),
+ RewriteInput, RewriteOutput);
+ testRuleFailure(makeRule(traverse(TK_AsIs, MatchedLoop), RewriteRule),
+ RewriteInput);
}
TEST_F(TransformerTest, TemplateInstantiation) {
More information about the cfe-commits
mailing list