[cfe-dev] determining Decl's source

Craig Silverstein csilvers at google.com
Tue Jul 19 17:03:48 PDT 2011

} 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

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


More information about the cfe-dev mailing list