[cfe-dev] one question about SourceLocation

Rambo hunanlwm at sina.cn
Mon Nov 19 04:25:21 PST 2012


Hi,
for this program:
for (i = 0; i < 5; i++)
{
    // have anything  at here;
    
 printf
("%d",
num
[i]);
   //other Codes at here; 
     } 
I want to get the SourceLocation by This codes:
if(isa<ArraySubscriptExpr>(s))
       {
          ArraySubscriptExpr *Decl2=cast<ArraySubscriptExpr>(s);
          Expr *lhs=Decl2->getRHS();
          SourceLocation ST=lhs->getExprLoc();
       }
 But I only get the Location before num[i],How can I get the SourceLocation
about "printf"?
I look forward your help.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/one-question-about-SourceLocation-tp4028358.html
Sent from the Clang Developers mailing list archive at Nabble.com.




More information about the cfe-dev mailing list