[cfe-dev] libtooling: how to get the list of include files for a translation unit

Wilhelm wilhelm.meier at fh-kl.de
Mon Aug 4 12:00:09 PDT 2014


Am 04.08.2014 um 14:53 schrieb Manuel Klimek:
> 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.

> 
> 
> On Wed, Jul 23, 2014 at 9:30 AM, Wilhelm <wilhelm.meier at fh-kl.de
> <mailto:wilhelm.meier at fh-kl.de>> wrote:
> 
>     Hi James,
> 
>     Am 21.07.2014 um 20:11 schrieb James Dennett:
>     > On Mon, Jul 21, 2014 at 9:18 AM, Wilhelm <wilhelm.meier at fh-kl.de
>     <mailto:wilhelm.meier at fh-kl.de>> wrote:
>     >> 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.
> 
>     thank you for this advice.
> 
>     I'm using clang::ClangTool to run an ASTFrontendAction over the source
>     files. I looked around, but I have no idea how to set the PPCallbacks to
>     the Preprocessor.
> 
>     Any help?
> 
>     --
>     Wilhelm
>     w.meier at unix.net <mailto:w.meier at unix.net>
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 


-- 
Wilhelm
w.meier at unix.net



More information about the cfe-dev mailing list