[cfe-dev] Ignoring system headers in a RecursiveASTVisitor

Gábor Kozár kozargabor at gmail.com
Sun Apr 14 01:27:23 PDT 2013

I believe what you need are

The documentation has the details:
Basically, you need to provide them with a SourceLocation, and they will
return a boolean value. The source location you can get for example using
clang::SourceManager::getLocForStartOfFile, or from any AST node.

2013/4/12 Tom Fairfield <antirush at gmail.com>

> I'm building a tool with the libtooling API - running an ASTFrontendAction
> with a RecursiveASTVisitor.
> By default, the visitor gets run for all included files, including system
> headers (<string> and the like).
> I can ignore all included files (and therefore only run on the files
> passed on the commandline) by overriding TraversDecl and checking
> context->getSourceManager().isFromMainFile(d->getLocation());
> Unfortunately, this stops me from traversing user included files.
> Ideally, I'd like to traverse non-system headers and ignore system
> headers.  Is there a way to accomplish this?
> Thanks!
> - Tom
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130414/864c3c82/attachment.html>

More information about the cfe-dev mailing list