[cfe-dev] Finding out if an assignment is within If statement's predicate

Himanshu via cfe-dev cfe-dev at lists.llvm.org
Sat Jul 30 10:45:01 PDT 2016


Hi All,

In my VisitBinaryOperator I want to treat assignments in IfStmt's predicate
check part differently
than the assignments in its body. For example:

if( (*ptrI = malloc(sizeof(int) * 10)) == NULL)  // => this assignment is
within predicate
        msg = "success"; // assignment in body (treat it differently than
the above)
else
        msg = "fail"; // assignment in body


Here, I would like to handle the ptrI = malloc assignment differently than
the other two assignments of 'msg'. I tries setting a flag in VisitIfStmt,
but that can't distinguish between the two different kind of assignments.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160730/34f04d10/attachment.html>


More information about the cfe-dev mailing list