Retrieve included header files

Hi,

Is there any way to retrieves the names of header files that are included in a source in clang?

Cheers,
Zheng

Here's one way. compile with

-save-temps -S -Xpreprocessor -CC <source_file.cpp>

and you will get a <source_file>.ii file generated showing the result of the
preprocessor, each of the headers included will be displayed in the form
they will be consumed by the compiler, along with line numbers and comments
intact.

-h

look at the class PreprocessingRecord. You create a PreprocessingRecord
before starting the pre-processor. After pre-processing you can use
PreprocessingRecord::iterator to look at each pre-processor event that
was recorded. The kind of pre-processor event you are interested in is
PreprocessedEntity::InclusionDirectiveKind.

Best regards,

Marko

Thanks Marko.

2011/6/19 Marko Sch├╝tz Schmuck <MarkoSchuetz@web.de>