determining Decl's source

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(D->getLocation());

Thanks

The way I've been doing this is the following:

   bool interestingLocation(SourceLocation loc) {
     // If we don't have a valid location... it's probably not interesting.
     if (loc.isInvalid())
       return false;
     // I'm not sure this is the best, since it's affected by #line and #file
     // et al. On the other hand, if I just do spelling, I get really wrong
     // values for locations in macros, especially when ## is involved.
     std::string filename = sm.getPresumedLoc(loc).getFilename();
     // Invalid locations and built-ins: not interesting at all
     if (filename[0] == '<')
       return false;

     return /* filename is in a directory I want */
   }

(I actually end up having a full hashtable of the returned filenames to the absolute path filename, since filenames are a lot more important to me than just skipping the "is this interesting")

} Some one in IRC mentioned using SourceManager to check the file it
} is in it

Yes, that's the right approach.

} looks like I would have todo something like
} Decl::getLocation()
} dyn_cast to a FullSourceLoc and use FullSourceLoc::getFileID()
} SourceManager::getFileEntryForID()
} FileEntry::getName()

You don't want to dyn_cast. You want to create a FullSourceLocation
using a SourceLocation and a SourceManager.

Look at
   http://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu_location_util.h

to see how we do this in include-what-you-use.

craig