[cfe-dev] AST dump - nodes are missing

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 17 16:42:33 PDT 2016


No problem.

btw I think we should make FAQ for clang-tools-extra to include issues like
this (actually Eugene wasn't using clang-check to dump, but I think it is
one of the common things.

If you have any other issues that you thing should be mentioned please
write it here:
https://docs.google.com/document/d/1_1G-Ib6bdi-Y0zvznJ2ZGLVUHpqMYJ4I7luOLKNj2Bg/edit?usp=sharing

2016-08-17 16:04 GMT-07:00 Eugene Kosov <claprix at yandex.ru>:

> Sure I did have errors. Thanks for your help!
>
> 18.08.2016, 00:03, "Piotr Padlewski" <piotr.padlewski at gmail.com>:
> > Are you sure you don't get any compiler errors?
> > It is usually the case when you get partial ast.
> >
> > 2016-08-17 13:27 GMT-07:00 Kirill Bobyrev via cfe-dev <
> cfe-dev at lists.llvm.org>:
> >> Matching IfStmt AST node on that line using clang-query works fine for
> me. Thus, clang isn’t a problem.
> >>
> >> - Kirill
> >>
> >>> On 17 Aug 2016, at 20:03, Eugene Kosov via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> >>>
> >>> 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
> >>
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> --
> Eugene
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160817/584155fe/attachment.html>


More information about the cfe-dev mailing list