diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -5567,7 +5567,7 @@ int i = 3.0; } The matcher - traverse(TK_IgnoreImplicitCastsAndParentheses, + traverse(TK_IgnoreUnlessSpelledInSource, varDecl(hasInitializer(floatLiteral().bind("init"))) ) matches the variable declaration with "init" bound to the "3.0". diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -782,7 +782,7 @@ /// \endcode /// The matcher /// \code -/// traverse(TK_IgnoreImplicitCastsAndParentheses, +/// traverse(TK_IgnoreUnlessSpelledInSource, /// varDecl(hasInitializer(floatLiteral().bind("init"))) /// ) /// \endcode diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -1873,8 +1873,8 @@ auto Matcher = varDecl(hasInitializer(floatLiteral())); EXPECT_TRUE(notMatches(VarDeclCode, traverse(TK_AsIs, Matcher))); - EXPECT_TRUE(matches(VarDeclCode, - traverse(TK_IgnoreImplicitCastsAndParentheses, Matcher))); + EXPECT_TRUE( + matches(VarDeclCode, traverse(TK_IgnoreUnlessSpelledInSource, Matcher))); auto ParentMatcher = floatLiteral(hasParent(varDecl(hasName("i")))); @@ -2715,14 +2715,14 @@ )cpp"; EXPECT_TRUE( - matches(Code, traverse(TK_IgnoreImplicitCastsAndParentheses, + matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, callExpr(has(callExpr(traverse( TK_AsIs, callExpr(has(implicitCastExpr( has(floatLiteral()))))))))))); EXPECT_TRUE(matches( Code, - traverse(TK_IgnoreImplicitCastsAndParentheses, + traverse(TK_IgnoreUnlessSpelledInSource, traverse(TK_AsIs, implicitCastExpr(has(floatLiteral())))))); } @@ -2738,8 +2738,7 @@ } )cpp"; - auto Matcher = - traverse(TK_IgnoreImplicitCastsAndParentheses, implicitCastExpr()); + auto Matcher = traverse(TK_IgnoreUnlessSpelledInSource, implicitCastExpr()); // Verfiy that it does not segfault EXPECT_FALSE(matches(Code, Matcher)); @@ -2766,7 +2765,7 @@ EXPECT_TRUE(matches( Code, functionDecl(anyOf(hasDescendant(Matcher), - traverse(TK_IgnoreImplicitCastsAndParentheses, + traverse(TK_IgnoreUnlessSpelledInSource, functionDecl(hasDescendant(Matcher))))))); }