[cfe-dev] libclang: missing some statements in the AST?

Philip Craig philipjcraig at gmail.com
Thu Jan 10 23:28:55 PST 2013


On 11 January 2013 15:08, huang jun wen <kassarar at gmail.com> wrote:
> Hi all,
>
> I'm new to libclang, recently I wrote a program for testing parsing,
> basically it output the ast to stdout. But when I run it over some source
> file, there are some statements missing? I can't figure out what happened.
> The question was originally posted at stackoverflow, but no reply until now
> :) Can any one give me some hints? Thanks very much.
>
> The problem's link:
> http://stackoverflow.com/questions/14250754/libclang-missing-some-statements-in-the-ast

The problem is that parsing is failing due to missing a stddef.h, so
the lines that fail to parse aren't in the AST. I can get it to work
on my system by running it like this:

./parse_ast -I/usr/local/bin/../lib/clang/3.3/include tt.c

There is some info on this at
http://clang.llvm.org/docs/LibTooling.html#builtin-includes. This
problem comes up a lot, so you could also search the list archive for
stddef.h for more discussion of it.



More information about the cfe-dev mailing list