[PATCH] D56444: [AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 9 06:53:38 PST 2019
sammccall added a comment.
In D56444#1351056 <https://reviews.llvm.org/D56444#1351056>, @aaron.ballman wrote:
> Given that, I kind of think we should have functionDecl() match only functions, and give users some other way to match the semantic declarations in a consistent manner. Alternatively, we could decide semantics are what we want to match (because it's what the AST encodes) and instead we give users a way to request to only match syntax.
I believe matching the implied semantic nodes is how closer to how matchers behave in general (corresponding to the fact that the ASTMatcher RecursiveASTVisitor sets `shouldVisitImplicitCode` to true). e.g.
$ cat ~/test.cc
void foo() { for (char c : "abc") {} }
$ bin/clang-query ~/test.cc --
clang-query> set output detailed-ast
clang-query> match binaryOperator()
Match #1:
Binding for "root":
BinaryOperator 0x471f038 </usr/local/google/home/sammccall/test.cc:1:26> '_Bool' '!='
|-ImplicitCastExpr 0x471f008 <col:26> 'const char *':'const char *' <LValueToRValue>
| `-DeclRefExpr 0x471efc8 <col:26> 'const char *':'const char *' lvalue Var 0x471ed48 '__begin1' 'const char *':'const char *'
`-ImplicitCastExpr 0x471f020 <col:26> 'const char *':'const char *' <LValueToRValue>
`-DeclRefExpr 0x471efe8 <col:26> 'const char *':'const char *' lvalue Var 0x471edb8 '__end1' 'const char *':'const char *'
etc
Obviously this is only true when such nodes are present in the AST at the time of matching (if I'm understanding Manuel's comment correctly).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56444/new/
https://reviews.llvm.org/D56444
More information about the cfe-commits
mailing list