[cfe-dev] Precompiled headers with libclang

Abhanshu Sharma abhanshu1 at gmail.com
Tue Apr 3 06:28:21 PDT 2012


To be precise, I am using 'clang_defaultEditingTranslationUnitOptions' with
clang_parseTranslationUnit();

 u*nsigned* clang_defaultEditingTranslationUnitOptions() {
   *return* CXTranslationUnit_PrecompiledPreamble |
            CXTranslationUnit_CacheCompletionResults;
 }


On Tue, Apr 3, 2012 at 6:55 PM, Abhanshu Sharma <abhanshu1 at gmail.com> wrote:

> I have actually set it 'on' already. But by running strace, I found that
> libclang is still accessing quite a few headers (Although Number of headers
> accessed reduced a bit).
> Is this expected?
>
> Or libclang is just expected to access preamble file? Is there any case
> where it can discard contents of preamble file.
>
> On Tue, Apr 3, 2012 at 6:49 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
>>
>>
>> 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
>>
>
>
>
> --
> Warm Regards,
> Abhanshu
>



-- 
Warm Regards,
Abhanshu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120403/1a660a83/attachment.html>


More information about the cfe-dev mailing list