Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using LLVM Clang 2.6 with Xcode 3.2

Tags:

xcode

llvm

clang

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.

like image 257
bitc Avatar asked Nov 11 '09 22:11

bitc


1 Answers

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.

like image 58
refulgentis Avatar answered Nov 15 '22 13:11

refulgentis