Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How do I get the member declaration for a member function call reference?

I have a C++ file and in it I have:

  std::string *k = new std::string("blah");
  k->append(3, 'c');

I have the file position of the append call. Is there a way I can find the declaration of the append member function for std::string (which is actually std::basic_string<char>) from the AST? Doing a dump of the AST via ASTPrinter, the information appears to be there. I am trying to narrow down which append() method is being called as there are multiple versions for std::basic_string<char>.

FWIW: I was able to locate the IASTName for the append call using the IASTNodeSelector and when I tried to use its binding and called getDeclarationsInAST(), I ended up with an empty list.

Thanks in advance,

-- Jeff J.

Back to the top