1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# 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/.
HostSharedLibrary("clang-plugin")
HOST_SOURCES += ["!ThirdPartyPaths.cpp"]
HOST_SOURCES += [
"ArithmeticArgChecker.cpp",
"AssertAssignmentChecker.cpp",
"CanRunScriptChecker.cpp",
"CustomAttributes.cpp",
"CustomTypeAnnotation.cpp",
"DanglingOnTemporaryChecker.cpp",
"DiagnosticsMatcher.cpp",
"ExplicitImplicitChecker.cpp",
"ExplicitOperatorBoolChecker.cpp",
"KungFuDeathGripChecker.cpp",
"MozCheckAction.cpp",
"MustOverrideChecker.cpp",
"MustReturnFromCallerChecker.cpp",
"MustUseChecker.cpp",
"NaNExprChecker.cpp",
"NeedsNoVTableTypeChecker.cpp",
"NoAddRefReleaseOnReturnChecker.cpp",
"NoAutoTypeChecker.cpp",
"NoDuplicateRefCntMemberChecker.cpp",
"NoExplicitMoveConstructorChecker.cpp",
"NoNewThreadsChecker.cpp",
"NonMemMovableMemberChecker.cpp",
"NonMemMovableTemplateArgChecker.cpp",
"NonParamInsideFunctionDeclChecker.cpp",
"NonTrivialTypeInFfiChecker.cpp",
"NoPrincipalGetURI.cpp",
"NoUsingNamespaceMozillaJavaChecker.cpp",
"OverrideBaseCallChecker.cpp",
"OverrideBaseCallUsageChecker.cpp",
"ParamTraitsEnumChecker.cpp",
"RefCountedCopyConstructorChecker.cpp",
"RefCountedInsideLambdaChecker.cpp",
"ScopeChecker.cpp",
"SprintfLiteralChecker.cpp",
"TemporaryLifetimeBoundChecker.cpp",
"TrivialCtorDtorChecker.cpp",
"TrivialDtorChecker.cpp",
"VariableUsageHelpers.cpp",
]
# Ideally, we wouldn't have compile-time choices wrt checkes. bug 1617153.
if CONFIG["OS_ARCH"] == "WINNT":
HOST_DEFINES["TARGET_IS_WINDOWS"] = True
HOST_SOURCES += [
"FopenUsageChecker.cpp",
"LoadLibraryUsageChecker.cpp",
]
if CONFIG["ENABLE_MOZSEARCH_PLUGIN"]:
HOST_SOURCES += [
"mozsearch-plugin/FileOperations.cpp",
"mozsearch-plugin/JSONFormatter.cpp",
"mozsearch-plugin/MozsearchIndexer.cpp",
"mozsearch-plugin/StringOperations.cpp",
]
GeneratedFile(
"ThirdPartyPaths.cpp",
script="ThirdPartyPaths.py",
entry_point="generate",
inputs=[
"/tools/rewriting/ThirdPartyPaths.txt",
"/tools/rewriting/Generated.txt",
],
)
GeneratedFile(
"ThreadAllows.h",
script="ThreadAllows.py",
entry_point="generate_file",
inputs=[
"/build/clang-plugin/ThreadAllows.txt",
"/build/clang-plugin/ThreadFileAllows.txt",
],
)
HOST_COMPILE_FLAGS["STL"] = []
HOST_COMPILE_FLAGS["VISIBILITY"] = []
# libc++ is required to build plugins against clang on OS X.
if CONFIG["HOST_OS_ARCH"] == "Darwin":
HOST_CXXFLAGS += ["-stdlib=libc++"]
# 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"] != "WINNT":
HOST_CXXFLAGS += ["-fPIC"]
DIRS += [
"tests",
]
include("external/sources.mozbuild")
if CONFIG["ENABLE_CLANG_PLUGIN_ALPHA"]:
HOST_DEFINES["MOZ_CLANG_PLUGIN_ALPHA"] = "1"
include("alpha/sources.mozbuild")
# 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"]:
HOST_COMPILE_FLAGS["HOST_CXXFLAGS"] = CONFIG["LLVM_CXXFLAGS"] + extra_cxxflags
# Avoid -DDEBUG=1 on the command line, which conflicts with a #define
# DEBUG(...) in llvm headers.
DEFINES["DEBUG"] = False
|