[cfe-users] Parsing C code looking for Basic Blocks
harald.servat at bsc.es
Tue Mar 19 04:43:26 PDT 2013
I'm a newcommer to Clang/LLVM and I'm not sure whether this is the
correct place to ask this topic. If it's not, would you mind to point me
to the correct place/list?
I'm looking for a mechanism to detect basic blocks in C codes
(optionally C++, and eventually Fortran, in a future). I'm wondering
whether how can Clang help me? Is it an appropriate tool for doing such
thing? I'm not looking for something very difficult (I think).
Imagine I have the following code (line numbering on the left, source
code on the right)
01: void foo(void)
03: int a = 10;
04: int b = 11;
05: if (a > b)
07: printf ("a is greater than b\n");
11: printf ("b is greater or equal than a\n");
I'd like to have a obtain a list of pairs that delimit the basic
blocks of the code. For the previous example, for instance it should
return something like : [01-05], [06-08], [10-12].
Is there any Clang mechanism to provide such information? If not, is
it possible to do it through Clang?
Thank you very much!
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.
More information about the cfe-users