[cfe-dev] Precompiled headers with libclang

Chandler Carruth chandlerc at google.com
Wed Apr 4 01:28:53 PDT 2012


On Wed, Apr 4, 2012 at 8:57 AM, Abhanshu Sharma <abhanshu1 at gmail.com> wrote:

> Douglas,
>
> I am exploring one more possibility. Is it possible for clang to just use
> precompile header file (without corresponding source header files
> available) to do its work?
>

I could be wrong, but I would not expect this to work. I think lots of
things still need to refer back to the underlying header files for printing
out snippets in diagnostics, etc.


> I don't want clang to check for any changes source headers file but simply
> use precompile header file.
>

Disabling the checks might be do-able -- but it's not clear to me why these
are a problem?


> If this is possible, I can create a single pch file for the source file
> and can quickly move setup across machines. This would be similar to .jars
> in java world.
>

Ahh. I wonder if it would help to use digests rather than timestamps for
these checks? Potentially as an optional mode?

While computing digests is more expensive than checking timestamps, it is
much less expensive than rebuilding a PCH image etc, so we could
potentially enable this in general as a layered system:

1) if timestamp + inode etc differ, and
2) if sha1 digests differ, then rebuild
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120404/d2677d8f/attachment.html>


More information about the cfe-dev mailing list