[PATCH] D56444: [AST] RecursiveASTVisitor visits lambda classes when implicit visitation is on.

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 9 07:12:27 PST 2019


steveire added a comment.

In D56444#1351130 <https://reviews.llvm.org/D56444#1351130>, @steveire wrote:

> In D56444#1351125 <https://reviews.llvm.org/D56444#1351125>, @aaron.ballman wrote:
>
> > if the location isn't somewhere in user code, then don't consider the node or its children for traversal. However, that may be insufficient and equally as mysterious behavior.
>
>
> That is exactly what I've implemented. I skip invisible nodes in matching and dumping: http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/EuYjAn


Just pasting the AST for comparison with the one Aaron posted:

  int main() {
    auto l = [](){ return 12; };
    int (*fp)() = l;
  }



  TranslationUnitDecl 0x5604ea6343e8 <<invalid sloc>> <invalid sloc>
  `-FunctionDecl 0x5604ea670470 <<source>:1:1, line:4:1> line:1:5 main 'int (void)'
    `-CompoundStmt 0x5604ea69b0e0 <col:12, line:4:1>
      |-DeclStmt 0x5604ea671260 <line:2:3, col:30>
      | `-VarDecl 0x5604ea6705b0 <col:3, col:29> col:8 used l 'class (lambda at <source>:2:12)':'class (lambda at <source>:2:12)' cinit
      |   `-LambdaExpr 0x5604ea670c60 <col:12, col:29> 'class (lambda at <source>:2:12)'
      |     `-CompoundStmt 0x5604ea670990 <col:16, col:29>
      |       `-ReturnStmt 0x5604ea670978 <col:18, col:25>
      |         `-IntegerLiteral 0x5604ea670838 <col:25> 'int' 12
      `-DeclStmt 0x5604ea69b0c8 <line:3:3, col:18>
        `-VarDecl 0x5604ea671310 <col:3, col:17> col:9 fp 'int (*)(void)' cinit
          `-DeclRefExpr 0x5604ea69af00 <col:17> 'class (lambda at <source>:2:12)':'class (lambda at <source>:2:12)' lvalue Var 0x5604ea6705b0 'l' 'class (lambda at <source>:2:12)':'class (lambda at <source>:2:12)'




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