[cfe-dev] NestedNameSpecifier-equivalent for CallExpr?

Lukhnos Liu lukhnos at lukhnos.org
Tue Jun 5 23:59:50 PDT 2012


Hi,

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:

  int B::foo(int x) {
    if (x < 1) {
      return A::foo(x);  // A is super of B
    }
    else {
      return foo(x - 1);
    }
  }

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?

Thanks!

Lukhnos





More information about the cfe-dev mailing list