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

Satya Prakash Prasad satyaprakash.prasad at gmail.com
Fri Jul 6 03:25:33 PDT 2012


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
                }
        }

        return true;
    }

Regards,
Prakash



More information about the cfe-dev mailing list