How to get the AST of a single cpp file with clang?

I know that it will never be fully accurate without the headers because C++
isn't context free.

Using the classic example of 'A B(C);', it means that it can be recognized
as a function declaration or an object definition. Either is fine for me. I
just need the file totally parsed.

I am not interested in the semantic analysis of the code, just in the
syntactic one and AFAIK the grammar of clang is one of the best.

The problem is that in some scenarios clang is avoiding some declarations
when it doesn't know the types although I guess it can correctly parse it.

See the following case. Content of class.cpp:

/ A::A() { }

In article <1384365395021-4036017.post@n3.nabble.com>,
    ruben <rdealba@codicesoftware.com> writes:

Is there any way to get the complete AST tree?

Have you looked at the extra tools repo? If you look at
remove-cstr-calls tool, it gets a complete AST for the source file
and does a source-to-source transformation on it.

This is not possible as far as I understand. Parsing and semantic analysis can’t be done as separate steps. Invalid nodes may be omitted from the AST.

Jason