how to precompile headers

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to precompile headers

Jochen Wilhelmy
Hi!

is it possible to precompile some headers using clang
and then inject it when I compile some code?
(Basically the usual precompiled headers feature)

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: how to precompile headers

Jean-Daniel Dupas-2

Le 11 mai 2010 à 22:51, Jochen Wilhelmy a écrit :

> Hi!
>
> is it possible to precompile some headers using clang
> and then inject it when I compile some code?
> (Basically the usual precompiled headers feature)
>

Yes. IIRC, you can use the -x flag to compile the header

clang -x c-header YourHeader.h -o YourHeader.gch

and the -include flag to include it.

clang -include YourHeader.gch ....


-- Jean-Daniel





_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: how to precompile headers

Jochen Wilhelmy
Hi!
> Yes. IIRC, you can use the -x flag to compile the header
>
>  
this sounds good, but I'd like to know how it works using the libraries.
Of course I can create the .gch like you told me, but then I want to
use a clang class to load it.

-Jochen

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: how to precompile headers

Ted Kremenek

On May 11, 2010, at 3:31 PM, Jochen Wilhelmy wrote:

> Hi!
>> Yes. IIRC, you can use the -x flag to compile the header
>>
>>
> this sounds good, but I'd like to know how it works using the libraries.
> Of course I can create the .gch like you told me, but then I want to
> use a clang class to load it.
>
> -Jochen

The CompilerInstance and ASTUnit classes are good places to start (both are in libFrontend).  You can also take a look at CIndex.cpp, which uses these classes to vend a C interface to Clang for building source code tools.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev