I am new to clang framework. I am trying to bind the entry points of CFG by using below code.
StatementMatcher BBlock= CFGBlock(expr().bind(“entrypoint”));
The code giving me errors. Please guide me, how can I bind entry and exit points of CFG of a program.
You can retrieve the entry point of a CFG with the getEnty() method. https://clang.llvm.org/doxygen/classclang_1_1CFG.html#a376a2e0d1a66a46f6514fe9b863f1f52 Could elaborate on what you’d like to achieve?
Actually I want to analyze the basic block of a program for fault localization. I have a pointer to CFG and from that pointer I can access every basic block. Consequently this will allow me to access the entry and exit. But by somehow, I am failed to
(1) locate the position (line and column number) of entry and exit point of basic block,
(2) iterate over the statements of the basic block through CFGElement object. I am using the srcManager to identify the position (line and col number).
Anyhow, thank you for your reply.
Can you please guide me (possibly with a snippet of code) that how may I iterate over the statements inside a basic block. Lets suppose, I have a pointer to basic block ptrBB.