[cfe-dev] Howto get include list question
Nico Weber
nicolasweber at gmx.de
Sat Sep 20 20:57:31 PDT 2008
Hi,
On 20.09.2008, at 03:34, Csaba Hruska wrote:
> I'd like to build source files dependecy tree according AST. I'm
> using this to build a dependency diagram in an IDE.
> How can i find the included files if i only have a reference to a
> TranslationUnit ?
> Is it possible ?
I think the easiest way is to get the main file id from the
TranslationUnit's AstContext's SourceManager, build a new Preprocessor
that preprocesses that file, and install a PPCallbacks object that
records the files it sees.
You could also walk the AST and look at all the SouceLocations you find.
Nico
More information about the cfe-dev
mailing list