libtooling: how to get the list of include files for a translation unit

Hi all,

I managed to write an RecursiveASTVisitor<> with libtooling.

Now I want to get the list of header files included to form the actual
translation unit. I googled for a while now, but got no idea how to
retrieve this information.

Any help?

One approach/starting point: If you provide an implementation of
PPCallbacks you can override FileChanged.

-- James

Hi James,

Hi James,

You can take a look at how clang-tidy does it:
tools-extra/clang-tidy/ClangTidy.cpp

You can take a look at how clang-tidy does it:
tools-extra/clang-tidy/ClangTidy.cpp

Tank you very much for this hint!

In

ASTFrontendAction::CreateASTConsumer(clang::CompilerInstance& compiler,
llvm::StringRef inputFile) {
  ...
        compiler.getPreprocessor().addPPCallbacks(new TestPPCallBack);
  ...
}

I managed to regsiter a PPCallBack.