libclang: missing some statements in the AST?

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 :slight_smile: Can any one give me some hints? Thanks very much.

The problem’s link:

Sincerely Yours,


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 This
problem comes up a lot, so you could also search the list archive for
stddef.h for more discussion of it.

It works, thx a lot !!

2013/1/11 Philip Craig <>

you might want to add some error handling, see page 15: