[cfe-dev] Precompiled headers with libclang

Douglas Gregor dgregor at apple.com
Tue Apr 3 06:19:38 PDT 2012



Sent from my iPhone

On Apr 3, 2012, at 4:00 AM, Abhanshu Sharma <abhanshu1 at gmail.com> wrote:

> Hi cfe-devs,
> 
> I have a particular scenario where there is a single changing source C++ file which depends on large number of header files (which are constant). What I want libclang to do is to just reparse this source file and extract rest of information from a single precompiled header file in lieu of those header files.
> 
> I am able to serialize and deserialize a Translation unit. But I am not able to serialize a TU and use it as a library.  Does .pch files work with libclang? 
> 
> For our needs, we have 1 changing C++ source file and rest everything is constant in very large codebase. And we want to repeatedly invoke code complete or error checks on these. Is this setup possible with libclang?

Just turn on precompiled preambles in libclang. After the first reparse, libclang will automatically create a PCH file for the headers at the top of your source file and use it for subsequent reparses and code completions. 

> -- 
> Regards,
> Abhanshu
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list