Hello Clangers,
I'm new to clang. I'm writing an AST Consumer plug-in to visit the
statements node and record the data in one of my table with line numbers.
I've this function callback ready: *VisitStmt(Stmt *S)*. My question is how
could I traverse If, while, for loop, boolean and Unary Operators
here
>>> }
>>> }
>>>
>>> The difference between cast and dyn_cast is that cast expects the
>>> pointer is the correct type without checking while dyn_cast does check the
>>> target type and returns a null pointer on a type mismatch. Chains of
st and
>>>>> dyn_cast functions and Stmt::getStmtClass() will tell the type of the
>>>>> Stmt. They are used as follows:
>>>>>
>>>>> void VisitStmt(Stmt *S) {
>>>>> if (BinaryOperator *BO = dyn_cast(S)) {
>>&g
Hello Clangers,
I've a Instrumentation pass code which add some more checks (or statements)
into the entry block (normal C functions). How could I debug it or add some
debug statements in IR code to make sure if the control is flowing through
that path or not.
Thanks and Regards.
Hello Cfe Users,
Could you please point to an effective way to get Source Location details
from an IR code.
>From the documentation, I think this could be a way:
Function Pass-> LLVM Value-> MDN->DILocation-> Source Location.
Please include any example if the above approach is correct too.
Thanks