Advantage of using clang
- Clang has a much better compilation speed than gcc
- Clang usually provides much better diagnostics in case your code fails to compile, which means that you need to spend less time trying to understand what you should do to fix your code. It even goes further by suggesting you of the most likely fixes.
Check out this page for more reasons why clang provides better compiler diagnotics.
Building and Installing clang
The following steps work on Mac and Linux only. Note that the clang port is not ready for everyday use yet, so I won’t recommend you switching to clang if you’re on Windows.
mkdir /path/to/clang-build cd /path/to/clang-build svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm cd llvm/tools svn co http://llvm.org/svn/llvm-project/cfe/trunk clang cd ../.. mkdir build cd build ../llvm/configure --enable-optimized --disable-assertions make && sudo make install
At this point, clang should be installed to /usr/local. In order to use it, you should add the following two lines to your mozconfig file:
export CC=clang export CXX=clang++
For more information, check out this page.