[cfe-dev] get_SubStmts_From_Stmt

Manuel Klimek klimek at google.com
Sun Feb 19 05:14:42 PST 2012

On Sun, Feb 19, 2012 at 1:01 PM, redder_0210 <redder_0210 at yeah.net> wrote:
> Dear  all,
>   I am interested in the operation on the CFGStmt.
>   Now I have got a CFGStmt like,"i = 1 + j*2;". What APIs and Structs should
> I make use of to get these three SubStmts (they are :1, j, 2) from the
>  parent Stmt ( it is i = 1 + j*2).

Look at the clang doxygen starting from Stmt
(http://clang.llvm.org/doxygen/classclang_1_1Stmt.html) to learn how
to traverse the AST. The general idea is that you dyn_cast your Stmt
into its real type, and then use the methods on that type to do the
traversal. See RecursiveASTVisitor for something more generic.


> Cheers.
> /by Redder.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list