[cfe-dev] Obtaining file name for functions from included files
felix.schmitt at zih.tu-dresden.de
Tue Jun 19 06:22:48 PDT 2012
Manuel Klimek <klimek at ...> writes:
> On Tue, Jun 19, 2012 at 2:34 PM, Felix Schmitt
<felix.schmitt <at> zih.tu-dresden.de> 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
> bool CMyASTVisitor::VisitFunctionDecl(FunctionDecl*
> const FileEntry* file_entry =
> if (file_entry == NULL)
> std::cout << "no file entry" << std::endl;
> Is there a way to get these filenames?
> Why does file_entry->getName() not work?
Because file_entry is NULL if the declaration found is
the main file but from an included file in the main file.
> cfe-dev mailing listcfe-dev-
Tmj1lob9twqVc3sceRu5cw at public.gmane.orghttp://
> cfe-dev mailing list
> cfe-dev at ...
More information about the cfe-dev