• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cc_defaults {
2    name: "clang-defaults",
3    defaults: [
4        "llvm-defaults",
5    ],
6    clang: true,
7
8    header_libs: ["clang-headers"],
9
10    cflags: [
11        "-pedantic",
12        "-Wcast-qual",
13        "-Wno-long-long",
14    ],
15
16    include_dirs: [
17        "external/clang/include",
18        "external/clang/lib/CodeGen",
19    ],
20
21    target: {
22        windows: {
23            enabled: true,
24            cflags: [
25                // This triggers an assertion on cross Windows builds.
26                "-Wno-error=uninitialized",
27            ],
28        },
29    },
30
31}
32
33clang_generated_headers = [
34    "clang-gen-options",
35    "clang-gen-attributes",
36    "clang-gen-checkers",
37    "clang-gen-comment-commands",
38    "clang-gen-comment-html-named-character-references",
39    "clang-gen-html-tags",
40    "clang-gen-comment-nodes",
41    "clang-gen-diagnostics",
42    "clang-gen-declnodes",
43    "clang-gen-statnodes",
44    "clang-gen-arm-neon",
45    "clang-version",
46    "llvm-gen-attributes",
47    "llvm-gen-intrinsics",
48]
49
50cc_library_headers {
51    name: "clang-headers",
52    vendor_available: true,
53    host_supported: true,
54    generated_headers: clang_generated_headers,
55    export_include_dirs: ["include"],
56    export_generated_headers: clang_generated_headers,
57    target: {
58        windows: {
59            enabled: true,
60        },
61    },
62}
63
64llvm_tblgen {
65    name: "clang-gen-options",
66    in: "include/clang/Driver/Options.td",
67    outs: ["clang/Driver/Options.inc"],
68}
69
70clang_tblgen {
71    name: "clang-gen-attributes",
72    in: "include/clang/Basic/Attr.td",
73    outs: [
74        "clang/AST/AttrDump.inc",
75        "clang/AST/AttrImpl.inc",
76        "clang/AST/Attrs.inc",
77        "clang/AST/AttrVisitor.inc",
78        "clang/Basic/AttrHasAttributeImpl.inc",
79        "clang/Basic/AttrList.inc",
80        "clang/Parse/AttrParserStringSwitches.inc",
81        "clang/Sema/AttrParsedAttrImpl.inc",
82        "clang/Sema/AttrParsedAttrKinds.inc",
83        "clang/Sema/AttrParsedAttrList.inc",
84        "clang/Sema/AttrSpellingListIndex.inc",
85        "clang/Sema/AttrTemplateInstantiate.inc",
86        "clang/Serialization/AttrPCHRead.inc",
87        "clang/Serialization/AttrPCHWrite.inc",
88    ],
89}
90
91clang_tblgen {
92    name: "clang-gen-checkers",
93    in: "include/clang/StaticAnalyzer/Checkers/Checkers.td",
94    outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"],
95}
96
97clang_tblgen {
98    name: "clang-gen-comment-commands",
99    in: "include/clang/AST/CommentCommands.td",
100    outs: [
101        "clang/AST/CommentCommandInfo.inc",
102        "clang/AST/CommentCommandList.inc",
103    ],
104}
105
106clang_tblgen {
107    name: "clang-gen-comment-html-named-character-references",
108    in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td",
109    outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"],
110}
111
112clang_tblgen {
113    name: "clang-gen-html-tags",
114    in: "include/clang/AST/CommentHTMLTags.td",
115    outs: [
116        "clang/AST/CommentHTMLTagsProperties.inc",
117        "clang/AST/CommentHTMLTags.inc",
118    ],
119}
120
121clang_tblgen {
122    name: "clang-gen-comment-nodes",
123    in: "include/clang/Basic/CommentNodes.td",
124    outs: ["clang/AST/CommentNodes.inc"],
125}
126
127clang_tblgen {
128    name: "clang-gen-diagnostics",
129    in: "include/clang/Basic/Diagnostic.td",
130    outs: [
131        "clang/Basic/DiagnosticAnalysisKinds.inc",
132        "clang/Basic/DiagnosticASTKinds.inc",
133        "clang/Basic/DiagnosticCommentKinds.inc",
134        "clang/Basic/DiagnosticCommonKinds.inc",
135        "clang/Basic/DiagnosticDriverKinds.inc",
136        "clang/Basic/DiagnosticFrontendKinds.inc",
137        "clang/Basic/DiagnosticLexKinds.inc",
138        "clang/Basic/DiagnosticParseKinds.inc",
139        "clang/Basic/DiagnosticSemaKinds.inc",
140        "clang/Basic/DiagnosticSerializationKinds.inc",
141        "clang/Basic/DiagnosticGroups.inc",
142        "clang/Basic/DiagnosticIndexName.inc",
143    ],
144}
145
146clang_tblgen {
147    name: "clang-gen-declnodes",
148    in: "include/clang/Basic/DeclNodes.td",
149    outs: ["clang/AST/DeclNodes.inc"],
150}
151
152clang_tblgen {
153    name: "clang-gen-statnodes",
154    in: "include/clang/Basic/StmtNodes.td",
155    outs: ["clang/AST/StmtNodes.inc"],
156}
157
158clang_tblgen {
159    name: "clang-gen-arm-neon",
160    in: "include/clang/Basic/arm_neon.td",
161    outs: [
162        "clang/Basic/arm_neon.inc",
163        "clang/Basic/arm_neon.h",
164    ],
165}
166
167genrule {
168    name: "clang-version",
169    cmd: "$(location) $(in) > $(out)",
170    tool_files: [
171        "clang-version-inc.py",
172        "version.py",
173    ],
174    srcs: [
175        "include/clang/Basic/Version.inc.in",
176    ],
177    out: ["clang/Basic/Version.inc"],
178}
179
180cc_library_shared {
181    name: "libclang",
182    defaults: [
183        "clang-defaults",
184        "force_build_llvm_components",
185    ],
186
187    host_supported: true,
188
189    whole_static_libs: [
190        "libclangAnalysis",
191        "libclangAST",
192        "libclangASTMatchers",
193        "libclangBasic",
194        "libclangCodeGen",
195        "libclangDriver",
196        "libclangEdit",
197        "libclangFormat",
198        "libclangFrontend",
199        "libclangIndex",
200        "libclangLex",
201        "libclangLibclang",
202        "libclangParse",
203        "libclangRewrite",
204        "libclangRewriteFrontend",
205        "libclangSema",
206        "libclangSerialization",
207        "libclangTooling",
208        "libclangToolingCore",
209    ],
210
211    export_shared_lib_headers: ["libLLVM"],
212    shared_libs: ["libLLVM"],
213    export_header_lib_headers: ["clang-headers"],
214
215    target: {
216        windows: {
217            host_ldlibs: [
218                "-limagehlp",
219                "-lpsapi",
220                "-lversion",
221            ],
222        },
223        darwin: {
224            shared_libs: ["libc++"],
225
226            host_ldlibs: [
227                "-ldl",
228                "-lpthread",
229            ],
230        },
231        linux: {
232            shared_libs: ["libc++"],
233
234            host_ldlibs: [
235                "-ldl",
236                "-lpthread",
237            ],
238        },
239    },
240
241    product_variables: {
242        unbundled_build: {
243            // Don't build the library in unbundled branches.
244            enabled: false,
245        },
246    },
247}
248
249subdirs = [
250    "lib",
251    "soong",
252    "utils/TableGen",
253    "tools/clang-check",
254    "tools/clang-format",
255    "tools/driver",
256    "tools/libclang",
257]
258