Bug 1316545 part 4 - Run clang.exe instead of clang-cl.exe for loading the plugin. r?ehsan, glandium draft
authorTing-Yu Chou <janus926@gmail.com>
Tue, 22 Nov 2016 14:20:58 +0800
changeset 446208 7aa2606deb257afa18ce0f54fea15325cf36c157
parent 446207 8fa11395b8fd16ecbd294200bf1fc2bfe13d6f3b
child 446209 2d4124215f20688dcb6c20e6a4f70d13bd5d6fed
push id37726
push userbmo:janus926@gmail.com
push dateThu, 01 Dec 2016 03:26:49 +0000
reviewersehsan, glandium
bugs1316545
milestone53.0a1
Bug 1316545 part 4 - Run clang.exe instead of clang-cl.exe for loading the plugin. r?ehsan, glandium MozReview-Commit-ID: K85tFo0nzoI
config/static-checking-config.mk
--- a/config/static-checking-config.mk
+++ b/config/static-checking-config.mk
@@ -1,12 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # The entire tree should be subject to static analysis using the XPCOM
 # script. Additional scripts may be added by specific subdirectories.
 
 ifdef ENABLE_CLANG_PLUGIN
+# Replace "clang-cl.exe" to "clang.exe --driver-mode=cl" to avoid loading the
+# module clang.exe again when load the plugin dll, which links to the import
+# library of clang.exe.
+ifeq ($(OS_ARCH),WINNT)
+CC := $(subst clang-cl.exe,clang.exe --driver-mode=cl,$(CC:.EXE=.exe))
+CXX := $(subst clang-cl.exe,clang.exe --driver-mode=cl,$(CXX:.EXE=.exe))
+endif
+
 CLANG_PLUGIN := $(topobjdir)/build/clang-plugin/$(DLL_PREFIX)clang-plugin$(DLL_SUFFIX)
 OS_CXXFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
 OS_CFLAGS += -Xclang -load -Xclang $(CLANG_PLUGIN) -Xclang -add-plugin -Xclang moz-check
 endif