[cfe-dev] How can I judge whether a "CFGElement" is in the for or while loop?

Shuai Wang wangshuai901 at gmail.com
Mon Nov 4 08:10:43 PST 2013


Hello,

I have got the CFG and I am analysing the CFGBlock of it.

I notice that in Clang, a for loop will be divide into several basic blocks
like :


       for (int a = 0, int i = 0; i< 5; i++)
               a++;

Then we can got:
       B1:  int a=0, int i =0;
       B2:  i < 5;
       B3:  i ++;
       B4:  a++;

and so on by using clang -cc1 -analyze -analyzer-checker=debug.DumpCFG xxx.c

My question is , when a got the first CFGElement of CFGBlock by using
CFGBlock.front();
How can I know this CFGElement is in the for loop?
(Which means my current analyzing block is B2 or B3 )

Thanks,
Shuai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131104/20eca892/attachment.html>


More information about the cfe-dev mailing list