Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1403346 - Define flags loading the clang plugin in configure rath…
Browse files Browse the repository at this point in the history
…er than the make backend. r=glandium

MozReview-Commit-ID: EubsjJl1LBS
  • Loading branch information
chmanchester committed Oct 25, 2017
1 parent 97c2f2f commit 1ea6b76
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
7 changes: 3 additions & 4 deletions build/autoconf/clang-plugin.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.

AC_DEFUN([MOZ_CONFIG_CLANG_PLUGIN], [
MOZ_ARG_ENABLE_BOOL(clang-plugin,
[ --enable-clang-plugin Enable building with the mozilla clang plugin ],
ENABLE_CLANG_PLUGIN=1,
ENABLE_CLANG_PLUGIN= )
if test -n "$ENABLE_CLANG_PLUGIN"; then
if test -z "${CLANG_CC}${CLANG_CL}"; then
AC_MSG_ERROR([Can't use clang plugin without clang.])
Expand Down Expand Up @@ -155,9 +151,12 @@ if test -n "$ENABLE_CLANG_PLUGIN"; then
LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DHAS_ACCEPTS_IGNORINGPARENIMPCASTS"
fi
CLANG_PLUGIN_FLAGS="-Xclang -load -Xclang $CLANG_PLUGIN -Xclang -add-plugin -Xclang moz-check"
AC_DEFINE(MOZ_CLANG_PLUGIN)
fi
AC_SUBST_LIST(CLANG_PLUGIN_FLAGS)
AC_SUBST(LLVM_CXXFLAGS)
AC_SUBST(LLVM_LDFLAGS)
AC_SUBST(CLANG_LDFLAGS)
Expand Down
1 change: 0 additions & 1 deletion build/moz.configure/old.configure
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def old_configure_options(*options):
'--enable-address-sanitizer',
'--enable-alsa',
'--enable-bundled-fonts',
'--enable-clang-plugin',
'--enable-content-sandbox',
'--enable-cookies',
'--enable-cpp-rtti',
Expand Down
7 changes: 7 additions & 0 deletions build/moz.configure/toolchain.configure
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,13 @@ set_config('LD_IS_BFD', depends(select_linker.KIND)
(lambda x: x == 'bfd' or None))
set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG)


js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
help="Enable building with the mozilla clang plugin")

add_old_configure_assignment('ENABLE_CLANG_PLUGIN',
depends_if('--enable-clang-plugin')(lambda _: True))

# Code Coverage
# ==============================================================

Expand Down
5 changes: 2 additions & 3 deletions config/static-checking-config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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
OS_CXXFLAGS += $(CLANG_PLUGIN_FLAGS)
OS_CFLAGS += $(CLANG_PLUGIN_FLAGS)
endif
16 changes: 16 additions & 0 deletions moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ def build_gtest(pgo, build_project, target, automation, enabled, enable_tests):

set_config('LINK_GTEST_DURING_COMPILE', build_gtest)

# clang-plugin location
# ==============================================================
@depends(library_name_info, check_build_environment, when='--enable-clang-plugin')
def clang_plugin_path(library_name_info, build_env):
topobjdir = build_env.topobjdir
if topobjdir.endswith('/js/src'):
topobjdir = topobjdir[:-7]
return os.path.abspath(
os.path.join(topobjdir, 'build', 'clang-plugin',
'%sclang-plugin%s' % (library_name_info.dll.prefix,
library_name_info.dll.suffix))
)

add_old_configure_assignment('CLANG_PLUGIN', clang_plugin_path)


# Awk detection
# ==============================================================
awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))
Expand Down

0 comments on commit 1ea6b76

Please sign in to comment.