tags:

views:

32

answers:

1

Hi,

Does anyone know if precompiled headers are supported when using Clang++ 2.0? I've installed Xcode 4 Developer Preview 2 which includes a Clang++ build that reports its version as "Apple clang version 2.0 (tags/Apple/clang-108.3))", but trying to replicate the basic PCH usage example at http://clang.llvm.org/docs/UsersManual.html#precompiledheaders for a C++ program with some STL headers in the PCH doesn't seem to work, i.e. build times are the same either way (~350ms in my case).

My guess is that PCHs for Clang++ just aren't supported fully at this stage, or for some reason you don't get much benefit from them, but maybe someone else knows more details?

The PCH created by Clang++ is ~2.5MB.

Thanks.

A: 

Looking at recent Clang commits reveals that C++ precompiled header support is present as of r110879, committed on 12 August 2010.

I checked out the LLVM and Clang sources and tested it - compile time went down by ~2.5x - nice!

This feature will no doubt make it into the next Xcode 4 prerelease/beta from Apple.

richard_nz