<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 3, 2012, at 6:25 AM, Abhanshu Sharma wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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></blockquote><div><br></div><div>You'll see libclang stat'ing all of the headers in the precompiled preamble, because it needs to determine whether they have changed.</div><br><blockquote type="cite">
<div>Or libclang is just expected to access preamble file? Is there any case where it can discard contents of preamble file.</div></blockquote><div><br></div><div>If the underlying headers change, or the #includes of the source file change, the precompiled preamble will be thrown out and regenerated.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">  </span>- Doug</div><br><blockquote type="cite"><div><div class="gmail_quote">On Tue, Apr 3, 2012 at 6:49 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">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 class="h5"><br>
On Apr 3, 2012, at 4:00 AM, Abhanshu Sharma <<a href="mailto:abhanshu1@gmail.com">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 class="HOEnZb"><font color="#888888"><br>
> --<br>
> Regards,<br>
> Abhanshu<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">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>-- <br>Warm Regards,<br>Abhanshu<br>
</div>
</blockquote></div><br></body></html>