2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2014-09-04 12:44:01 +04:00
|
|
|
# vim: set filetype=python:
|
|
|
|
# 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/.
|
|
|
|
|
2018-07-05 08:58:09 +03:00
|
|
|
HostSharedLibrary('clang-plugin')
|
2014-09-04 12:44:01 +04:00
|
|
|
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_SOURCES += ['!ThirdPartyPaths.cpp']
|
2017-04-27 19:44:46 +03:00
|
|
|
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_SOURCES += [
|
2016-12-18 00:35:53 +03:00
|
|
|
'ArithmeticArgChecker.cpp',
|
|
|
|
'AssertAssignmentChecker.cpp',
|
2017-08-08 19:48:53 +03:00
|
|
|
'CanRunScriptChecker.cpp',
|
2018-09-18 16:03:33 +03:00
|
|
|
'CustomAttributes.cpp',
|
2016-12-18 00:35:53 +03:00
|
|
|
'CustomTypeAnnotation.cpp',
|
2017-07-05 17:14:21 +03:00
|
|
|
'DanglingOnTemporaryChecker.cpp',
|
2016-12-18 00:35:53 +03:00
|
|
|
'DiagnosticsMatcher.cpp',
|
|
|
|
'ExplicitImplicitChecker.cpp',
|
|
|
|
'ExplicitOperatorBoolChecker.cpp',
|
|
|
|
'KungFuDeathGripChecker.cpp',
|
|
|
|
'MozCheckAction.cpp',
|
2016-12-19 03:42:04 +03:00
|
|
|
'MustOverrideChecker.cpp',
|
2017-01-17 03:11:41 +03:00
|
|
|
'MustReturnFromCallerChecker.cpp',
|
2016-12-19 04:30:47 +03:00
|
|
|
'MustUseChecker.cpp',
|
2016-12-18 00:35:53 +03:00
|
|
|
'NaNExprChecker.cpp',
|
|
|
|
'NeedsNoVTableTypeChecker.cpp',
|
|
|
|
'NoAddRefReleaseOnReturnChecker.cpp',
|
|
|
|
'NoAutoTypeChecker.cpp',
|
|
|
|
'NoDuplicateRefCntMemberChecker.cpp',
|
|
|
|
'NoExplicitMoveConstructorChecker.cpp',
|
|
|
|
'NonMemMovableMemberChecker.cpp',
|
|
|
|
'NonMemMovableTemplateArgChecker.cpp',
|
|
|
|
'NonParamInsideFunctionDeclChecker.cpp',
|
|
|
|
'OverrideBaseCallChecker.cpp',
|
|
|
|
'OverrideBaseCallUsageChecker.cpp',
|
2017-12-05 18:26:41 +03:00
|
|
|
'ParamTraitsEnumChecker.cpp',
|
2016-12-18 00:35:53 +03:00
|
|
|
'RefCountedCopyConstructorChecker.cpp',
|
|
|
|
'RefCountedInsideLambdaChecker.cpp',
|
|
|
|
'ScopeChecker.cpp',
|
|
|
|
'SprintfLiteralChecker.cpp',
|
|
|
|
'TrivialCtorDtorChecker.cpp',
|
2017-07-05 17:14:21 +03:00
|
|
|
'VariableUsageHelpers.cpp',
|
2014-09-04 12:44:01 +04:00
|
|
|
]
|
|
|
|
|
2018-03-07 15:36:44 +03:00
|
|
|
if CONFIG['OS_ARCH'] == 'WINNT':
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_SOURCES += [
|
2018-03-07 15:36:44 +03:00
|
|
|
'LoadLibraryUsageChecker.cpp',
|
|
|
|
]
|
|
|
|
|
2017-11-10 02:04:33 +03:00
|
|
|
if CONFIG['ENABLE_MOZSEARCH_PLUGIN']:
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_SOURCES += [
|
2017-11-10 02:04:33 +03:00
|
|
|
'mozsearch-plugin/FileOperations.cpp',
|
|
|
|
'mozsearch-plugin/JSONFormatter.cpp',
|
|
|
|
'mozsearch-plugin/MozsearchIndexer.cpp',
|
|
|
|
'mozsearch-plugin/StringOperations.cpp',
|
|
|
|
]
|
|
|
|
|
2017-04-27 19:44:46 +03:00
|
|
|
GENERATED_FILES += ['ThirdPartyPaths.cpp']
|
|
|
|
third_party_paths = GENERATED_FILES['ThirdPartyPaths.cpp']
|
|
|
|
third_party_paths.script = "ThirdPartyPaths.py:generate"
|
|
|
|
third_party_paths.inputs = [
|
|
|
|
'/tools/rewriting/ThirdPartyPaths.txt',
|
|
|
|
]
|
|
|
|
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_COMPILE_FLAGS['STL'] = []
|
|
|
|
HOST_COMPILE_FLAGS['VISIBILITY'] = []
|
2014-09-04 12:44:01 +04:00
|
|
|
|
2015-09-28 20:19:35 +03:00
|
|
|
# libc++ is required to build plugins against clang on OS X.
|
|
|
|
if CONFIG['HOST_OS_ARCH'] == 'Darwin':
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_CXXFLAGS += ['-stdlib=libc++']
|
2015-09-28 20:19:35 +03:00
|
|
|
|
2019-04-02 05:18:10 +03:00
|
|
|
# As of clang 8, llvm-config doesn't output the flags used to build clang
|
|
|
|
# itself, so we don't end up with -fPIC as a side effect. llvm.org/PR8220
|
|
|
|
if CONFIG['HOST_OS_ARCH'] != 'Windows':
|
|
|
|
HOST_CXXFLAGS += ['-fPIC']
|
|
|
|
|
2014-09-04 12:44:01 +04:00
|
|
|
DIRS += [
|
|
|
|
'tests',
|
|
|
|
]
|
2017-10-26 01:12:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
# In the current moz.build world, we need to override essentially every
|
|
|
|
# variable to limit ourselves to what we need to build the clang plugin.
|
|
|
|
if CONFIG['HOST_OS_ARCH'] == 'WINNT':
|
|
|
|
extra_cxxflags = ['-GR-', '-EHsc']
|
|
|
|
else:
|
|
|
|
extra_cxxflags = ['-fno-rtti', '-fno-exceptions']
|
|
|
|
|
|
|
|
if CONFIG['LLVM_CXXFLAGS']:
|
2018-07-05 08:58:09 +03:00
|
|
|
HOST_COMPILE_FLAGS['HOST_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags
|
2018-06-08 04:36:07 +03:00
|
|
|
|
|
|
|
# Avoid -DDEBUG=1 on the command line, which conflicts with a #define
|
|
|
|
# DEBUG(...) in llvm headers.
|
|
|
|
DEFINES['DEBUG'] = False
|