[cfe-dev] determining Decl's source

ret val retval386 at gmail.com
Tue Jul 19 16:44:59 PDT 2011


I am using  RecursiveASTVistor and implementing the VisitDecl() method.
While trying to collect all the Decs for function calls and function
pointers, I also collect those from standard libraries. I would like to skip
these and only look at Decs from the input files.

I am wondering what a good way to go about this is. Decl::hasBody() looks
interested, but wouldnt account for inline functions. Could this be fixed?

Some one in IRC mentioned using SourceManager to check the file it is in it
looks like I would have todo something like
Decl::getLocation()
dyn_cast to a FullSourceLoc and use FullSourceLoc::getFileID()
SourceManager::getFileEntryForID()
FileEntry::getName()

But I'm having problems with the dyn_cast, my nonfunctional one looks like
this and I'm not sure how to correct it.
FullSourceLoc &loc = dyn_cast<FullSourceLoc>(D->getLocation());

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110719/eda5f0d9/attachment.html>


More information about the cfe-dev mailing list