[cfe-dev] Basic source-to-source transformation with Clang

Manuel Klimek klimek at google.com
Fri Jul 6 03:52:00 PDT 2012


On Fri, Jul 6, 2012 at 12:25 PM, Satya Prakash Prasad <
satyaprakash.prasad at gmail.com> wrote:

> I made some progress with whatever support I received from this
> discussion forum. Thanks to all who responded to my request. My
> requirement now is to find a way I can print CLANG AST code to C++ / C
> human readable statements:
>
>     bool VisitStmt(Stmt *s) {
>         if (isa<CompoundStmt>(s)) {
>                 CompoundStmt *S = cast<CompoundStmt>(s);
>                 for (CompoundStmt::body_iterator  I = S->body_begin(),
> E = S->body_end(); I != E; ++I)
>                 {
>                         Stmt *i =  cast<Stmt>(*I);
>                         //How can I print the C++ / C statement which
> CLANG is processing
>

You can use i->dumpAll() if you want to see what's going on.

Cheers,
/Manuel


>                 }
>         }
>
>         return true;
>     }
>
> Regards,
> Prakash
> _______________________________________________
> 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/20120706/7d283de5/attachment.html>


More information about the cfe-dev mailing list