[cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-07-30 Thread Ayush Mittal via cfe-users
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

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-08-06 Thread Ayush Mittal via cfe-users
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

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-08-07 Thread Ayush Mittal via cfe-users
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

[cfe-users] Debugging LLVM IR code

2019-09-06 Thread Ayush Mittal via cfe-users
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.

[cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-11 Thread Ayush Mittal via cfe-users
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