[cfe-dev] NestedNameSpecifier-equivalent for CallExpr?
lukhnos at lukhnos.org
Wed Jun 6 11:19:36 PDT 2012
DeclRefExpr indeed solves half of the problem (for non-method calls). I found for C++ methods I need to handle instead MemberExpr and use getMemberLoc() to get the location of F() as in X->F() or X::F().
On Jun 6, 2012, at 9:28 AM, Jordan Rose wrote:
> Hi, Lukhnos. You can get the function/method/whatever being called using CallExpr::getCallee, and from there you should be able to pick it apart if it's a DeclRefExpr. (Note that a callee could easily /not/ be a DeclRefExpr, say if it's a lambda expression.)
> Is that what you're looking for?
> On Jun 5, 2012, at 23:59 , Lukhnos Liu <lukhnos at lukhnos.org> wrote:
>> When we are dealing with types, it is easy to extract the different parts of a nested name specifier by getting one from DeclaratorDecl::getQualifierLoc(). Is anything similar available to CallExpr?
>> For example, when we are writing a method renaming tool, and we come upon this:
>> CallExpr::getLocStart() gives us the beginning locations of "A::foo" and "foo". But for the former, I'm interested in the exact location of the identifier "foo" (the other info I can get from getDirectCallee()). I can't figure out a way to do it other than parsing the range between the start loc and the left parenthesis. Or did I miss anything?
More information about the cfe-dev