To be precise, I am using '<span style="background-color:yellow">clang_defaultEditingTranslationUnitOptions' </span>with clang_parseTranslationUnit(); <br><div><pre> u<u style="color:rgb(0,0,139);text-decoration:none">nsigned</u> <span style="background-color:yellow">clang_defaultEditingTranslationUnitOptions</span>() {
   <u style="color:rgb(0,0,139);text-decoration:none">return</u> CXTranslationUnit_PrecompiledPreamble | 
            CXTranslationUnit_CacheCompletionResults;
 }</pre><br><div class="gmail_quote">On Tue, Apr 3, 2012 at 6:55 PM, Abhanshu Sharma <span dir="ltr"><<a href="mailto:abhanshu1@gmail.com">abhanshu1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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). <div>Is this expected? </div><div><br></div>

<div>Or libclang is just expected to access preamble file? Is there any case where it can discard contents of preamble file.</div><div><div><div class="h5"><br><div class="gmail_quote">On Tue, Apr 3, 2012 at 6:49 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Sent from my iPhone<br>
<div><div><br>
On Apr 3, 2012, at 4:00 AM, Abhanshu Sharma <<a href="mailto:abhanshu1@gmail.com" target="_blank">abhanshu1@gmail.com</a>> wrote:<br>
<br>
> Hi cfe-devs,<br>
><br>
> 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.<br>


><br>
> 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?<br>
><br>
> 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?<br>


<br>
</div></div>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.<br>


<span><font color="#888888"><br>
> --<br>
> Regards,<br>
> Abhanshu<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Warm Regards,<br>Abhanshu<br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Warm Regards,<br>Abhanshu<br>
</div>