[cfe-dev] AST dump - nodes are missing

Alexey Sidorin via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 17 14:04:28 PDT 2016


Hello Eugene,

Many AST nodes in your dump are marked as invalid. Are you sure your 
compilation command is correct? Maybe you need some additional includes 
or defines?

17.08.2016 21:03, Eugene Kosov via cfe-dev пишет:
> Hello.
>
> This is what I'm doing.
>
> clang++ -cc1 -I/home/kevg/Desktop/llvm_playground/llvm/include -ast-dump llvm_playground/llvm/lib/Support/SmallVector.cpp
>
> And this is how SmallVector::grow_pod looks like.
>
> `-CXXMethodDecl 0x2e3ddc8 parent 0x2e15fc0 <line:19:1, line:41:1> line:19:23 invalid grow_pod 'void (void *, int, int)'
>    |-ParmVarDecl 0x2e3dc50 <col:32, col:38> col:38 used FirstEl 'void *'
>    |-ParmVarDecl 0x2e3dcc0 <col:47, col:54> col:54 invalid MinSizeInBytes 'int'
>    |-ParmVarDecl 0x2e3dd30 <line:20:32, col:39> col:39 invalid TSize 'int'
>    |-CompoundStmt 0x2e502c8 <col:46, line:41:1>
>    | |-DeclStmt 0x2e3df58 <line:21:3, col:40>
>    | | `-VarDecl 0x2e3dee0 <col:3, col:10> col:10 invalid CurSizeBytes 'int'
>    | |-DeclStmt 0x2e3e018 <line:22:3, col:62>
>    | | `-VarDecl 0x2e3df80 <col:3, col:10> col:10 invalid NewCapacityInBytes 'int'
>    | |-DeclStmt 0x2e3e0a0 <line:26:3, col:16>
>    | | `-VarDecl 0x2e3e040 <col:3, col:9> col:9 used NewElts 'void *'
>    | |-IfStmt 0x2e4fe70 <line:27:3, line:35:3>
>    | | |-<<<NULL>>>
>    | | |-<<<NULL>>>
>    | | |-BinaryOperator 0x2e3e160 <line:27:7, col:17> '_Bool' '=='
>    | | | |-ImplicitCastExpr 0x2e3e130 <col:7> 'void *' <LValueToRValue>
>    | | | | `-MemberExpr 0x2e3e0d0 <col:7> 'void *' lvalue ->BeginX 0x2e161b0
>    | | | |   `-CXXThisExpr 0x2e3e0b8 <col:7> 'class llvm::SmallVectorBase *' this
>    | | | `-ImplicitCastExpr 0x2e3e148 <col:17> 'void *' <LValueToRValue>
>    | | |   `-DeclRefExpr 0x2e3e108 <col:17> 'void *' lvalue ParmVar 0x2e3dc50 'FirstEl' 'void *'
>    | | |-CompoundStmt 0x2e4fd78 <col:26, line:32:3>
>    | | `-CompoundStmt 0x2e4fe58 <col:10, line:35:3>
>    | `-BinaryOperator 0x2e501b0 <line:39:3, col:18> 'void *' lvalue '='
>    |   |-MemberExpr 0x2e50138 <col:3, col:9> 'void *' lvalue ->BeginX 0x2e161b0
>    |   | `-CXXThisExpr 0x2e50120 <col:3> 'class llvm::SmallVectorBase *' this
>    |   `-ImplicitCastExpr 0x2e50198 <col:18> 'void *' <LValueToRValue>
>    |     `-DeclRefExpr 0x2e50170 <col:18> 'void *' lvalue Var 0x2e3e040 'NewElts' 'void *'
>    `-FullComment 0x2e62600 <line:17:4, line:18:72>
>      `-ParagraphComment 0x2e625d0 <line:17:4, line:18:72>
>        |-TextComment 0x2e62580 <line:17:4, col:78> Text=" grow_pod - This is an implementation of the grow() method which only works"
>        `-TextComment 0x2e625a0 <line:18:4, col:72> Text=" on POD-like datatypes and is out of line to reduce code duplication."
>
> Source code https://github.com/llvm-mirror/llvm/blob/master/lib/Support/SmallVector.cpp#L17
>
> There is no first 'if' at all, last line is absent too.
>
> Some nodes disappeared.
>
> I'm writing a clang-based tool and when I try to use RecursiveASTVisitor on that declaration it can't find those absent nodes too.
>
> Is this a bug or some kind of strange behaviour?
>
> $ clang++ --version
> clang version 4.0.0-svn278304-1~exp1 (trunk)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
>
> --
> Eugene
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list