[cfe-dev] Default Headers with CompilerInstance

Mehdi AMINI mehdi.amini at silkan.com
Thu Nov 8 10:42:28 PST 2012


Hi,



Le 08/11/2012 10:22, Manuel Klimek a écrit :
> See here for what's needed to build a tool on top of clang:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?revision=166508&view=markup
> (the solution is to use the Driver, which handles finding of builtin and
> system includes)
>
> Alternatively, you can just use the tooling library :) (see
> http://clang.llvm.org/docs/LibTooling.html)

None of these solutions relieves you from building your binary at the 
same place at Clang is installed, or duplicate the Clang headers along 
your tool installation so that they are in PATH_TO_BIN/../lib/...
Or did I miss something at some point?

>     I tried to add the system headers manually using
>     "HeaderSearchOptions.Add" but (1) this is not portable and (2)
>     anyway I can't make that work either.
>
>     Could you please explain me more in details how Clang does to find
>     the default system headers ?
>     I attach the source file of my simple prototype.


 From my (very shallow) experience, unless you get very deep with the 
initialization it end up by looking the headers from the place the 
binary is installed.

Best,

Mehdi




More information about the cfe-dev mailing list