Want to have a little fun with the cutting edge LLVM? Here's how to install the latest "tip of the trunk" llvm + clang, as described from clang's getting started page:
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
./configure --prefix=/opt --enable-optimized
sudo make install
Assuming everything went ok, llvm + clang should be installed in /opt now.
(This is what make -j16 does to my box. Fun times.)
Next we'll need to tell Xcode how to use it, and that's done by installing a little plugin named Clang LLVM TOT.xcplugin.zip. Download that, unzip it, and place it in /Developer/Library/Xcode/Plug-ins. You'll probably need to restart Xcode at this point.
Next, we'll need to tell your project to use the new compiler, which you can do so in it's build settings:
And, that's it. Build away! Notice lots new errors and warnings! Of course, you're only going to want to use this for debug builds, as shipping code built with the latest LLVM is probably a very bad idea. Who knows what crazy bugs have been introduced into your compiler. Apple Developer Relations would probably like me to say that this point that the only compilers that are supported for the Mac are the ones that ship with Xcode. END DISCLAIMER HERE.
It would be great if you could also somehow tell Xcode to use the static analyzer in /opt as well, but I'm unaware of any way to do that. If you know how, please let me know and I'll update this post with instructions.
Update: Tim Wood lets us know how to use an updated analyzer. And it turns out you don't need the downloadable plugin using his technique. Sweet. Thanks Tim!