Author: Stephen Kelly Date: 2020-01-20T11:38:23Z New Revision: 8248190a730cd62850afe9bef731ce6726778b4b
URL: https://github.com/llvm/llvm-project/commit/8248190a730cd62850afe9bef731ce6726778b4b DIFF: https://github.com/llvm/llvm-project/commit/8248190a730cd62850afe9bef731ce6726778b4b.diff LOG: Fix clang-formatting for recent commits Added: Modified: clang/lib/ASTMatchers/ASTMatchFinder.cpp clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp Removed: ################################################################################ diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 39a3d8e3750c..f62c7ab5ed04 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -64,7 +64,7 @@ struct MatchKey { bool operator<(const MatchKey &Other) const { return std::tie(Traversal, MatcherID, Node, BoundNodes) < std::tie(Other.Traversal, Other.MatcherID, Other.Node, - Other.BoundNodes); + Other.BoundNodes); } }; diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp index 27f446467fa3..2143bb4965bb 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -1635,12 +1635,11 @@ void foo() auto ParentMatcher = floatLiteral(hasParent(varDecl(hasName("i")))); - EXPECT_TRUE( - notMatches(VarDeclCode, traverse(ast_type_traits::TK_AsIs, ParentMatcher))); - EXPECT_TRUE( - matches(VarDeclCode, - traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - ParentMatcher))); + EXPECT_TRUE(notMatches(VarDeclCode, + traverse(ast_type_traits::TK_AsIs, ParentMatcher))); + EXPECT_TRUE(matches(VarDeclCode, + traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + ParentMatcher))); EXPECT_TRUE( matches(VarDeclCode, decl(traverse(ast_type_traits::TK_AsIs, @@ -1723,12 +1722,13 @@ void bar() functionDecl(hasName("foo"), traverse(ast_type_traits::TK_AsIs, hasDescendant(floatLiteral()))))); + EXPECT_TRUE(notMatches(Code, traverse(ast_type_traits::TK_AsIs, + floatLiteral(hasParent(callExpr(callee( + functionDecl(hasName("foo"))))))))); EXPECT_TRUE( - notMatches(Code, traverse(ast_type_traits::TK_AsIs, floatLiteral(hasParent(callExpr(callee(functionDecl(hasName("foo"))))))))); - EXPECT_TRUE( - matches(Code, - traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - floatLiteral(hasParent(callExpr(callee(functionDecl(hasName("foo"))))))))); + matches(Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + floatLiteral(hasParent(callExpr( + callee(functionDecl(hasName("foo"))))))))); Code = R"cpp( void foo() @@ -1740,10 +1740,10 @@ void foo() matches(Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, varDecl(hasInitializer(integerLiteral(equals(3))))))); - EXPECT_TRUE( - matches(Code, - traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - integerLiteral(equals(3), hasParent(varDecl(hasName("i"))))))); + EXPECT_TRUE(matches( + Code, + traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + integerLiteral(equals(3), hasParent(varDecl(hasName("i"))))))); } template <typename MatcherT> @@ -1927,8 +1927,9 @@ void func14() { EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - integerLiteral(equals(42), hasParent(returnStmt(forFunction(functionDecl(hasName("func1")))))) - ))); + integerLiteral(equals(42), + hasParent(returnStmt(forFunction( + functionDecl(hasName("func1"))))))))); EXPECT_TRUE(matches( Code, @@ -1939,7 +1940,10 @@ void func14() { EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - integerLiteral(equals(42), hasParent(cxxTemporaryObjectExpr(hasParent(returnStmt(forFunction(functionDecl(hasName("func2"))))))))))); + integerLiteral( + equals(42), + hasParent(cxxTemporaryObjectExpr(hasParent(returnStmt( + forFunction(functionDecl(hasName("func2"))))))))))); EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, @@ -1949,8 +1953,12 @@ void func14() { integerLiteral(equals(42))))))))); EXPECT_TRUE(matches( - Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - integerLiteral(equals(42), hasParent(cxxFunctionalCastExpr(hasParent(returnStmt(forFunction(functionDecl(hasName("func3")))) ))))))); + Code, + traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + integerLiteral( + equals(42), + hasParent(cxxFunctionalCastExpr(hasParent(returnStmt( + forFunction(functionDecl(hasName("func3"))))))))))); EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, @@ -1992,7 +2000,9 @@ void func14() { EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - declRefExpr(to(varDecl(hasName("a"))), hasParent(returnStmt(forFunction(functionDecl(hasName("func10"))))))))); + declRefExpr(to(varDecl(hasName("a"))), + hasParent(returnStmt(forFunction( + functionDecl(hasName("func10"))))))))); EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, @@ -2002,8 +2012,9 @@ void func14() { EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - declRefExpr(to(varDecl(hasName("b"))), hasParent(returnStmt(forFunction(functionDecl(hasName("func11")))))) - ))); + declRefExpr(to(varDecl(hasName("b"))), + hasParent(returnStmt(forFunction( + functionDecl(hasName("func11"))))))))); EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, @@ -2013,8 +2024,9 @@ void func14() { EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, - declRefExpr(to(varDecl(hasName("c"))), hasParent(returnStmt(forFunction(functionDecl(hasName("func12")))))) - ))); + declRefExpr(to(varDecl(hasName("c"))), + hasParent(returnStmt(forFunction( + functionDecl(hasName("func12"))))))))); EXPECT_TRUE(matches( Code, @@ -2028,17 +2040,18 @@ void func14() { has(parmVarDecl(hasName("d"))))))); EXPECT_TRUE(matches( - Code, - traverse( - ast_type_traits::TK_IgnoreUnlessSpelledInSource, - declRefExpr(to(varDecl(hasName("a"))), hasParent( lambdaExpr(forFunction(functionDecl(hasName("func13")))) ))))); + Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + declRefExpr(to(varDecl(hasName("a"))), + hasParent(lambdaExpr(forFunction( + functionDecl(hasName("func13"))))))))); EXPECT_TRUE(matches( Code, - traverse( - ast_type_traits::TK_IgnoreUnlessSpelledInSource, - varDecl(hasName("b"), hasInitializer(declRefExpr(to( - varDecl(hasName("c"))))), hasParent( lambdaExpr(forFunction(functionDecl(hasName("func13")))) ))))); + traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, + varDecl(hasName("b"), + hasInitializer(declRefExpr(to(varDecl(hasName("c"))))), + hasParent(lambdaExpr( + forFunction(functionDecl(hasName("func13"))))))))); EXPECT_TRUE(matches( Code, traverse(ast_type_traits::TK_IgnoreUnlessSpelledInSource, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits