<div dir="ltr">Are you sure you don't get any compiler errors? <div>It is usually the case when you get partial ast.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-17 13:27 GMT-07:00 Kirill Bobyrev via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Matching IfStmt AST node on that line using clang-query works fine for me. Thus, clang isn’t a problem.<br>
<br>
- Kirill<br>
<div class="HOEnZb"><div class="h5">> On 17 Aug 2016, at 20:03, Eugene Kosov via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hello.<br>
><br>
> This is what I'm doing.<br>
><br>
> clang++ -cc1 -I/home/kevg/Desktop/llvm_<wbr>playground/llvm/include -ast-dump llvm_playground/llvm/lib/<wbr>Support/SmallVector.cpp<br>
><br>
> And this is how SmallVector::grow_pod looks like.<br>
><br>
> `-CXXMethodDecl 0x2e3ddc8 parent 0x2e15fc0 <line:19:1, line:41:1> line:19:23 invalid grow_pod 'void (void *, int, int)'<br>
>  |-ParmVarDecl 0x2e3dc50 <col:32, col:38> col:38 used FirstEl 'void *'<br>
>  |-ParmVarDecl 0x2e3dcc0 <col:47, col:54> col:54 invalid MinSizeInBytes 'int'<br>
>  |-ParmVarDecl 0x2e3dd30 <line:20:32, col:39> col:39 invalid TSize 'int'<br>
>  |-CompoundStmt 0x2e502c8 <col:46, line:41:1><br>
>  | |-DeclStmt 0x2e3df58 <line:21:3, col:40><br>
>  | | `-VarDecl 0x2e3dee0 <col:3, col:10> col:10 invalid CurSizeBytes 'int'<br>
>  | |-DeclStmt 0x2e3e018 <line:22:3, col:62><br>
>  | | `-VarDecl 0x2e3df80 <col:3, col:10> col:10 invalid NewCapacityInBytes 'int'<br>
>  | |-DeclStmt 0x2e3e0a0 <line:26:3, col:16><br>
>  | | `-VarDecl 0x2e3e040 <col:3, col:9> col:9 used NewElts 'void *'<br>
>  | |-IfStmt 0x2e4fe70 <line:27:3, line:35:3><br>
>  | | |-<<<NULL>>><br>
>  | | |-<<<NULL>>><br>
>  | | |-BinaryOperator 0x2e3e160 <line:27:7, col:17> '_Bool' '=='<br>
>  | | | |-ImplicitCastExpr 0x2e3e130 <col:7> 'void *' <LValueToRValue><br>
>  | | | | `-MemberExpr 0x2e3e0d0 <col:7> 'void *' lvalue ->BeginX 0x2e161b0<br>
>  | | | |   `-CXXThisExpr 0x2e3e0b8 <col:7> 'class llvm::SmallVectorBase *' this<br>
>  | | | `-ImplicitCastExpr 0x2e3e148 <col:17> 'void *' <LValueToRValue><br>
>  | | |   `-DeclRefExpr 0x2e3e108 <col:17> 'void *' lvalue ParmVar 0x2e3dc50 'FirstEl' 'void *'<br>
>  | | |-CompoundStmt 0x2e4fd78 <col:26, line:32:3><br>
>  | | `-CompoundStmt 0x2e4fe58 <col:10, line:35:3><br>
>  | `-BinaryOperator 0x2e501b0 <line:39:3, col:18> 'void *' lvalue '='<br>
>  |   |-MemberExpr 0x2e50138 <col:3, col:9> 'void *' lvalue ->BeginX 0x2e161b0<br>
>  |   | `-CXXThisExpr 0x2e50120 <col:3> 'class llvm::SmallVectorBase *' this<br>
>  |   `-ImplicitCastExpr 0x2e50198 <col:18> 'void *' <LValueToRValue><br>
>  |     `-DeclRefExpr 0x2e50170 <col:18> 'void *' lvalue Var 0x2e3e040 'NewElts' 'void *'<br>
>  `-FullComment 0x2e62600 <line:17:4, line:18:72><br>
>    `-ParagraphComment 0x2e625d0 <line:17:4, line:18:72><br>
>      |-TextComment 0x2e62580 <line:17:4, col:78> Text=" grow_pod - This is an implementation of the grow() method which only works"<br>
>      `-TextComment 0x2e625a0 <line:18:4, col:72> Text=" on POD-like datatypes and is out of line to reduce code duplication."<br>
><br>
> Source code <a href="https://github.com/llvm-mirror/llvm/blob/master/lib/Support/SmallVector.cpp#L17" rel="noreferrer" target="_blank">https://github.com/llvm-<wbr>mirror/llvm/blob/master/lib/<wbr>Support/SmallVector.cpp#L17</a><br>
><br>
> There is no first 'if' at all, last line is absent too.<br>
><br>
> Some nodes disappeared.<br>
><br>
> 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.<br>
><br>
> Is this a bug or some kind of strange behaviour?<br>
><br>
> $ clang++ --version<br>
> clang version 4.0.0-svn278304-1~exp1 (trunk)<br>
> Target: x86_64-pc-linux-gnu<br>
> Thread model: posix<br>
> InstalledDir: /usr/bin<br>
><br>
> --<br>
> Eugene<br>
> ______________________________<wbr>_________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>