Source code

Revision control

Other Tools

1
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2
# vim: set filetype=python:
3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
HostSharedLibrary('clang-plugin')
8
9
HOST_SOURCES += ['!ThirdPartyPaths.cpp']
10
11
HOST_SOURCES += [
12
'ArithmeticArgChecker.cpp',
13
'AssertAssignmentChecker.cpp',
14
'CanRunScriptChecker.cpp',
15
'CustomAttributes.cpp',
16
'CustomTypeAnnotation.cpp',
17
'DanglingOnTemporaryChecker.cpp',
18
'DiagnosticsMatcher.cpp',
19
'ExplicitImplicitChecker.cpp',
20
'ExplicitOperatorBoolChecker.cpp',
21
'KungFuDeathGripChecker.cpp',
22
'MozCheckAction.cpp',
23
'MustOverrideChecker.cpp',
24
'MustReturnFromCallerChecker.cpp',
25
'MustUseChecker.cpp',
26
'NaNExprChecker.cpp',
27
'NeedsNoVTableTypeChecker.cpp',
28
'NoAddRefReleaseOnReturnChecker.cpp',
29
'NoAutoTypeChecker.cpp',
30
'NoDuplicateRefCntMemberChecker.cpp',
31
'NoExplicitMoveConstructorChecker.cpp',
32
'NonMemMovableMemberChecker.cpp',
33
'NonMemMovableTemplateArgChecker.cpp',
34
'NonParamInsideFunctionDeclChecker.cpp',
35
'NoUsingNamespaceMozillaJavaChecker.cpp',
36
'OverrideBaseCallChecker.cpp',
37
'OverrideBaseCallUsageChecker.cpp',
38
'ParamTraitsEnumChecker.cpp',
39
'RefCountedCopyConstructorChecker.cpp',
40
'RefCountedInsideLambdaChecker.cpp',
41
'ScopeChecker.cpp',
42
'SprintfLiteralChecker.cpp',
43
'TempRefPtrChecker.cpp',
44
'TrivialCtorDtorChecker.cpp',
45
'TrivialDtorChecker.cpp',
46
'VariableUsageHelpers.cpp',
47
]
48
49
if CONFIG['OS_ARCH'] == 'WINNT':
50
HOST_SOURCES += [
51
'LoadLibraryUsageChecker.cpp',
52
]
53
54
if CONFIG['ENABLE_MOZSEARCH_PLUGIN']:
55
HOST_SOURCES += [
56
'mozsearch-plugin/FileOperations.cpp',
57
'mozsearch-plugin/JSONFormatter.cpp',
58
'mozsearch-plugin/MozsearchIndexer.cpp',
59
'mozsearch-plugin/StringOperations.cpp',
60
]
61
62
GeneratedFile('ThirdPartyPaths.cpp', script="ThirdPartyPaths.py",
63
entry_point="generate", inputs=[
64
'/tools/rewriting/ThirdPartyPaths.txt',
65
'/tools/rewriting/Generated.txt',
66
])
67
68
HOST_COMPILE_FLAGS['STL'] = []
69
HOST_COMPILE_FLAGS['VISIBILITY'] = []
70
71
# libc++ is required to build plugins against clang on OS X.
72
if CONFIG['HOST_OS_ARCH'] == 'Darwin':
73
HOST_CXXFLAGS += ['-stdlib=libc++']
74
75
# As of clang 8, llvm-config doesn't output the flags used to build clang
76
# itself, so we don't end up with -fPIC as a side effect. llvm.org/PR8220
77
if CONFIG['HOST_OS_ARCH'] != 'WINNT':
78
HOST_CXXFLAGS += ['-fPIC']
79
80
DIRS += [
81
'tests',
82
]
83
84
85
# In the current moz.build world, we need to override essentially every
86
# variable to limit ourselves to what we need to build the clang plugin.
87
if CONFIG['HOST_OS_ARCH'] == 'WINNT':
88
extra_cxxflags = ['-GR-', '-EHsc']
89
else:
90
extra_cxxflags = ['-fno-rtti', '-fno-exceptions']
91
92
if CONFIG['LLVM_CXXFLAGS']:
93
HOST_COMPILE_FLAGS['HOST_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags
94
95
# Avoid -DDEBUG=1 on the command line, which conflicts with a #define
96
# DEBUG(...) in llvm headers.
97
DEFINES['DEBUG'] = False