[cfe-dev] How to determine clang's system include dirs, to set in ASTVisitor?

Manuel Klimek klimek at google.com
Thu Dec 20 08:34:40 PST 2012


On Wed, Dec 19, 2012 at 3:16 PM, Peeter Joot <peeter.joot at gmail.com> wrote:

> If I use llvm-config --cxxflags, it gives me, among other stuff the -I
> path for clangs headers.
>
> Is there a way to get the system includes paths that clang uses
> internally, either programatically (query set of default system includes
> for the target) or on the command line using something like llvm-config, so
> that I can set those same paths in my ASTVisitor.  Without that I get
> include failures with various system headers:
>
> In file included from xx.C:1:
> /vbs/common/osse/core/inc/osstype.h:29:10: fatal error: 'stdlib.h' file
> not found
> #include <stdlib.h>
>          ^
>
> Alternately, is there a way to include the system includes paths by
> default?  Looking in
>
> http://clang.llvm.org/doxygen/HeaderSearchOptions_8h_source.html
>
> it appears that UseStandardSystemIncludes, and UseStandardCXXIncludes both
> default to true, which explains why setting those didn't make a difference.
>  Are those fields not being respected for some reason?
>

By the way, the LibTooling stuff (as well as writing a clang plugin) solves
the system include paths in general,
and the builtin include path (which is your problem) when you put the tool
next to a clang executable.

Cheers,
/Manuel


> --
> Peeter
>
> _______________________________________________
> 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/20121220/076d82c8/attachment.html>


More information about the cfe-dev mailing list