[cfe-dev] How to get the Location of SystemFunction,I used the SourceLocation and miss some trouble

flappybird kingsleynj at 163.com
Sat May 24 04:47:56 PDT 2014


hello,I try to Insert some code before a function when it was called.for
example:
char *p,*q;
  strcpy(p,q);
^                  ^
I want to insert some code at this two place,but I failed to handle it.
I used just like this:
 VisitCallExpr(CallExpr *CE){
if(FunctionDecl *FD=CE->getDirectCallee()) 
{
...
SourceRange sr = FD->getSourceRange();
SourceLocation ST1 = sr.getBegin();
...
}
}

but I found it make no difference when I used  Rewrite.InsertText(ST1,
tempfc, true, true);
trying to insert some code into it.
would you please tell me what's wrong with it and show me how to some this
problem
thank you



--
View this message in context: http://clang-developers.42468.n3.nabble.com/How-to-get-the-Location-of-SystemFunction-I-used-the-SourceLocation-and-miss-some-trouble-tp4039650.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list