[cfe-dev] Obtaining file name for functions from included files
doob at me.com
Tue Jun 19 13:53:35 PDT 2012
On 2012-06-19 14:34, Felix Schmitt wrote:
> I got the following problem:
> I need to traverse the AST (currently using RecursiveASTVisitor) and get the
> file name for every function declaration.
> Currently, I only get the filename for function declarations in my main file but
> how do I get these for functions in #included files?
> My relevant code looks like this (srcMgr is the SourceManager):
> bool CMyASTVisitor::VisitFunctionDecl(FunctionDecl* decl)
> const FileEntry* file_entry =
> if (file_entry == NULL)
> std::cout<< "no file entry"<< std::endl;
> Is there a way to get these filenames?
I'm using the following functions from the C bindings:
May you could have a look at the implementation of those functions if no
one else has a quicker solution.
More information about the cfe-dev