We have this wrapper that invokes cl for us: http://dxr.mozilla.org/mozilla-central/source/config/config.mk#122 http://dxr.mozilla.org/mozilla-central/source/python/mozbuild/mozbuild/action/cl.py#1 so that we can get at the includes via /showincludes and write the GCC-style dependency files we want for |make|. Doing this adds an extra process invocation on every compiler invocation on Windows, which is reasonably expensive. We can avoid this with clang-cl, though! clang-cl is just clang, after all, and clang knows how to write out GCC-style dependency files directly. We can therefore ditch our wrapper (and /showincludes) and win back some compilation time. Passing the necessary options will probably have to be done through -Xclang, as IIRC the clang-cl binary doesn't understand the options we need.
The compiler's not happy about forwarding the arguments: $ clang -MP -MD -MF bar foo.cpp $ clang-cl -Xclang -MP -Xclang -MD -Xclang -MF -Xclang bar foo.cpp error: unknown argument: '-MD' error: unknown argument: '-MF' $ clang --driver-mode=cl -Xclang -MP -Xclang -MD -Xclang -MF -Xclang bar ../foo.cpp error: unknown argument: '-MD' error: unknown argument: '-MF' Why no complaint about -MP? The difference in those flags (https://github.com/llvm-mirror/clang/blob/master/include/clang/Driver/Options.td#L348-L364) is that -MP has "Flags<[CC1Option]>" while the others don't. I'm out of my expertise here, so I'm guessing: does this mean -MD and -MF are gcc-driver options that can't be used because the clang-cl pipeline is just "cl-driver -> cc1" ?