views:

831

answers:

2

So, I've just downloaded the LLVM Clang (2.6) binaries.
Mac OS X 10.6 comes with Clang 1.0.

Do you know how to integrate a later version of Clang with the Xcode 3.2.x IDE?


Just overwriting files seems a little bit risky.

+1  A: 

So, dont overwrite! Rename them to their respective version (e.g. clang-1.0), then create a symbolic link to the one you want. If something goes wrong, you can switch it to the original version.

/Developer/usr/bin .. in case you dont know where the bins are.

empc
+6  A: 

First off – you're referring to clang 1.0 based on LLVM 2.6. There is no clang 2.6, only a clang 1.0 based on LLVM 2.6. The clang issued with LLVM 2.6 is the same as the one with Xcode 3.2. (see Wikipedia: "On October 23, 2009 Clang 1.0 was released along with LLVM 2.6 for the first time"; I also know this from personal experience).

Secondly – you can integrate any version of clang, even one you build from clang's SVN. To do so, I have a .xcconfig file (a plain text file with the .xcconfig suffix) with two settings included:

GCC_VERSION = com.apple.compilers.llvm.clang.1_0
CC = /Users/jpo/Development/oss/llvm/Debug/bin/clang

Then, I add the xcconfig file to my project (because it contains some other warnings I like to turn on, such as the ones Peter Hosey recommends). Then, in the bottom right of the build settings tab for my project I tell it to be 'Based on' the name of my xcconfig file.

This all works out great, because then you can just keep the files from clang SVN in a directory on your drive, and build it, and your Xcode projects will use always use your latest built version since it always will be at that path. Of course, building clang itself is a time-consuming process, but its still really, really, cool to be using bleeding-edge technology.

refulgentis