Clang is the compiler used by default to build Firefox.
- Clang is used for all platforms (Linux, Mac, Windows and Android) supported by Firefox.
- Clang has a better compilation speed than gcc.
- Clang usually provides 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 the most likely fixes.
Check out this page for more reasons why clang provides better compiler diagnostics.
Most of the GNU/Linux distributions are coming with a recent clang version. For example, under Debian or Ubuntu, the following command will install clang:
apt-get install clang # or, to force a specific version of clang: apt-get install clang-8
The LLVM community is also proposing nightly Debian & Ubuntu package repositories of the most recent versions of clang
Under Mac OS X, clang is the default compiler shipped with Xcode.
In order to use clang instead of gcc, you should add the following two lines to your mozconfig file:
export CC=clang export CXX=clang++ # or, force a specific version of clang: export CC=clang-8 export CXX=clang++-8
For more information, check out this page.