[cfe-dev] Problem in wrapping statements

Awanish via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 11 04:45:06 PST 2017


Hi

I have to wrap all the expression which uses logical, relational and 
comparison operator. I am doing this by


         virtual bool VisitBinaryOperator(BinaryOperator *bo){
             if(bo->isLogicalOp()  || bo->isComparisonOp() || 
bo->isRelationalOp()){
                 std::string name= "WRAPCONDITION(";
rewriter.InsertTextBefore(bo->getLHS()->getLocStart(),name);
                 name = " ) ";
rewriter.InsertTextAfterToken(bo->getRHS()->getLocEnd(),name);
             }
             return true;
         }
But this is giving me some wiered answer

Ex

a = b == c;

output is

a = WRAPCONDITION(b == c ; // closing bracket is missing.

Can anyone please help me in this?

-- 
Thanks and Regards
Awanish Pandey
PhD, CSE
IIT Kanpur




More information about the cfe-dev mailing list