This article needs a technical review. How you can help.
Introduction
clang-cl is a new compiler from the LLVM project that attempts to be a drop-in replacement for MSVC's cl.exe. It also brings the full power of the LLVM toolchain to Windows. We now have unofficial support for building with clang-cl on Windows.
Prerequisites
You will need a working copy of clang-cl. You can either download a recent LLVM snapshot, or you'll need to build from source, using the commands below. Note that you need to run these commands inside an MSVC shell. You will need git, cmake, and ninja.
git clone https://llvm.org/git/llvm.git cd llvm cd tools git clone https://llvm.org/git/clang.git cd ..\projects git clone https://llvm.org/git/compiler-rt.git cd ..\.. mkdir llvm-objdir cd llvm-objdir cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 ..\llvm ninja
You may drop the LLVM_TARGETS_TO_BUILD option above if you want a compiler that can generate code for all of the architectures that LLVM supports, at the cost of more disk space and slightly longer build times.
No matter how you get your clang-cl binary, you need to make sure that the bin directory either inside the objdir or in the extracted ZIP package is in your PATH before you attempt to build Firefox.
Building with clang-cl
In order to build Firefox with clang-cl, grab a recent mozilla-central tree, and add the below to your mozconfig:
export CC="clang-cl.exe" export CXX="clang-cl.exe"
And then, proceed to build as normal.