[PATCH] D91917: Update mode used in traverse() examples
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 23 06:28:43 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf052cf494f07: Update mode used in traverse() examples (authored by stephenkelly).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91917/new/
https://reviews.llvm.org/D91917
Files:
clang/docs/LibASTMatchersReference.html
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
Index: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===================================================================
--- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ 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)))))));
}
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ 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
Index: clang/docs/LibASTMatchersReference.html
===================================================================
--- clang/docs/LibASTMatchersReference.html
+++ 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".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91917.307064.patch
Type: text/x-patch
Size: 2894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201123/e96f5a1c/attachment.bin>
More information about the cfe-commits
mailing list