[cfe-dev] creating and walking the AST

Guoping Long longguoping at gmail.com
Tue Oct 11 11:22:36 PDT 2011


Hi, Josef

   I just went through this process several weeks ago. Those tutorials are
too old to suit new revisions of Clang.
   Attached is an simple (runnable) program to experiment the uninitialized
variables analysis (implemented in
tools/clang/lib/Analysis/UninitializedValues.cpp).
   Hope this helps.

-----
Guoping

2011/10/11 josef maxim pohl <josef.m.pohl at gmail.com>

> Hi there,
>
> I have been banging my head against clang for a bit now trying to get a
> sense of how a few things work.  Hence I have a complete beginner type
> question.
>
> I am simply trying to construct an AST which I can use to do some source
> transformations.
> In trying to work through some of the examples and older tutorials I have
> noticed that many use a preprocessor instance.  With the recent version of
> clang there seems to be a fundamental difference in the way a preprocessor
> object is constructed.  My first question is can anyone tell me how to
> reconcile the old methodology with the new.  (ie does anyone have a decent
> example of this.)
>
> The other approach to constructing an AST, it appears, is through the
> construction of a CompilerInstance.  However I have only seen this used in
> plugin operations or in examples that are not constructing an AST.  Are
> there any good examples of this behavior (operation) in a stand alone
> application?
>
> Please feel free to correct my misguided notions of what is going on and I
> apologize for the complete beginner questions.
> Thanks
> Josef
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111011/c15ea7c0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 3268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111011/c15ea7c0/attachment.cpp>


More information about the cfe-dev mailing list