[cfe-dev] Getting started with source code analysis using CLang

Martin C. Martin martin at martincmartin.com
Sun Mar 14 14:58:49 PDT 2010


Hi Stefan,

The Parser class is probably what you want, it produces an AST.  You can 
look at the existing Frontend to see how its constructed & called.  You 
can also start clang with a trivial C program and set breakpoints to 
find out what code paths are actually taken.

As far as I can tell, there isn't a lot of documentation outside of the 
code itself.  But the code is very well written, so it should be easy to 
figure it out.

Best,
Martin

On 3/14/2010 5:48 PM, Stefan Seefeld wrote:
> Hello,
>
> I'm looking at various bits of CLang code, trying to figure out the very
> first steps needed to:
>
> 1) parse a source file into an internal representation suitable for
> static code analysis.
> 2) navigate that representation (via CIndex, as Doug suggested).
>
> Can anyone give me some hints as to what specific API to use for this ?
>
> Is there some documentation for this that I have overlooked ?
>
> Thanks,
>
>           Stefan
>



More information about the cfe-dev mailing list