[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / utils / bazel / llvm-project-overlay / clang / BUILD.bazel
blob1996451d34a52aea8463c417179f09a18cb499f7
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 load("//llvm:tblgen.bzl", "gentbl")
6 load("//llvm:binary_alias.bzl", "binary_alias")
7 load("//llvm:cc_plugin_library.bzl", "cc_plugin_library")
9 package(
10     default_visibility = ["//visibility:public"],
11     licenses = ["notice"],
14 exports_files([
15     "tools/clang-format/clang-format.el",
16     "tools/clang-format/clang-format-test.el",
17     "tools/clang-format/clang-format.py",
18     "tools/clang-rename/clang-rename.el",
19     "tools/extra/clang-include-fixer/tool/clang-include-fixer.el",
20     "tools/extra/clang-include-fixer/tool/clang-include-fixer-test.el",
23 cc_binary(
24     name = "clang-tblgen",
25     srcs = glob([
26         "utils/TableGen/*.cpp",
27         "utils/TableGen/*.h",
28     ]),
29     copts = [
30         "$(STACK_FRAME_UNLIMITED)",
31     ],
32     linkopts = ["-ldl"],
33     stamp = 0,
34     deps = [
35         "//llvm:Support",
36         "//llvm:TableGen",
37         "//llvm:config",
38     ],
41 gentbl(
42     name = "diagnostic_defs_gen",
43     tbl_outs = [(
44         "-gen-clang-diags-defs -clang-component=%s" % c,
45         "include/clang/Basic/Diagnostic%sKinds.inc" % c,
46     ) for c in [
47         "AST",
48         "Analysis",
49         "Comment",
50         "Common",
51         "CrossTU",
52         "Driver",
53         "Frontend",
54         "Lex",
55         "Parse",
56         "Refactoring",
57         "Sema",
58         "Serialization",
59     ]] + [
60         (
61             "-gen-clang-diag-groups",
62             "include/clang/Basic/DiagnosticGroups.inc",
63         ),
64         (
65             "-gen-clang-diags-index-name",
66             "include/clang/Basic/DiagnosticIndexName.inc",
67         ),
68     ],
69     tblgen = ":clang-tblgen",
70     td_file = "include/clang/Basic/Diagnostic.td",
71     td_srcs = glob(["include/clang/Basic/*.td"]),
74 gentbl(
75     name = "basic_arm_neon_inc_gen",
76     tbl_outs = [(
77         "-gen-arm-neon-sema",
78         "include/clang/Basic/arm_neon.inc",
79     )],
80     tblgen = ":clang-tblgen",
81     td_file = "include/clang/Basic/arm_neon.td",
82     td_srcs = [
83         "include/clang/Basic/arm_neon.td",
84         "include/clang/Basic/arm_neon_incl.td",
85     ],
88 gentbl(
89     name = "basic_arm_fp16_inc_gen",
90     tbl_outs = [(
91         "-gen-arm-neon-sema",
92         "include/clang/Basic/arm_fp16.inc",
93     )],
94     tblgen = ":clang-tblgen",
95     td_file = "include/clang/Basic/arm_fp16.td",
96     td_srcs = [
97         "include/clang/Basic/arm_fp16.td",
98         "include/clang/Basic/arm_neon_incl.td",
99     ],
102 gentbl(
103     name = "basic_arm_mve_aliases_gen",
104     tbl_outs = [(
105         "-gen-arm-mve-builtin-aliases",
106         "include/clang/Basic/arm_mve_builtin_aliases.inc",
107     )],
108     tblgen = ":clang-tblgen",
109     td_file = "include/clang/Basic/arm_mve.td",
110     td_srcs = [
111         "include/clang/Basic/arm_mve.td",
112         "include/clang/Basic/arm_mve_defs.td",
113     ],
116 gentbl(
117     name = "basic_arm_sve_builtins_gen",
118     tbl_outs = [(
119         "-gen-arm-sve-builtins",
120         "include/clang/Basic/arm_sve_builtins.inc",
121     )],
122     tblgen = ":clang-tblgen",
123     td_file = "include/clang/Basic/arm_sve.td",
124     td_srcs = [
125         "include/clang/Basic/arm_sve.td",
126     ],
129 gentbl(
130     name = "basic_arm_sve_builtin_cg_gen",
131     tbl_outs = [(
132         "-gen-arm-sve-builtin-codegen",
133         "include/clang/Basic/arm_sve_builtin_cg.inc",
134     )],
135     tblgen = ":clang-tblgen",
136     td_file = "include/clang/Basic/arm_sve.td",
137     td_srcs = [
138         "include/clang/Basic/arm_sve.td",
139     ],
142 gentbl(
143     name = "basic_arm_sve_typeflags_gen",
144     tbl_outs = [(
145         "-gen-arm-sve-typeflags",
146         "include/clang/Basic/arm_sve_typeflags.inc",
147     )],
148     tblgen = ":clang-tblgen",
149     td_file = "include/clang/Basic/arm_sve.td",
150     td_srcs = [
151         "include/clang/Basic/arm_sve.td",
152     ],
155 gentbl(
156     name = "basic_arm_sve_sema_rangechecks_gen",
157     tbl_outs = [(
158         "-gen-arm-sve-sema-rangechecks",
159         "include/clang/Basic/arm_sve_sema_rangechecks.inc",
160     )],
161     tblgen = ":clang-tblgen",
162     td_file = "include/clang/Basic/arm_sve.td",
163     td_srcs = [
164         "include/clang/Basic/arm_sve.td",
165     ],
168 gentbl(
169     name = "basic_arm_mve_cg_gen",
170     tbl_outs = [(
171         "-gen-arm-mve-builtin-codegen",
172         "include/clang/Basic/arm_mve_builtin_cg.inc",
173     )],
174     tblgen = ":clang-tblgen",
175     td_file = "include/clang/Basic/arm_mve.td",
176     td_srcs = [
177         "include/clang/Basic/arm_mve.td",
178         "include/clang/Basic/arm_mve_defs.td",
179     ],
182 gentbl(
183     name = "basic_arm_mve_inc_gen",
184     tbl_outs = [(
185         "-gen-arm-mve-builtin-def",
186         "include/clang/Basic/arm_mve_builtins.inc",
187     )],
188     tblgen = ":clang-tblgen",
189     td_file = "include/clang/Basic/arm_mve.td",
190     td_srcs = [
191         "include/clang/Basic/arm_mve.td",
192         "include/clang/Basic/arm_mve_defs.td",
193     ],
196 gentbl(
197     name = "basic_arm_mve_sema_gen",
198     tbl_outs = [(
199         "-gen-arm-mve-builtin-sema",
200         "include/clang/Basic/arm_mve_builtin_sema.inc",
201     )],
202     tblgen = ":clang-tblgen",
203     td_file = "include/clang/Basic/arm_mve.td",
204     td_srcs = [
205         "include/clang/Basic/arm_mve.td",
206         "include/clang/Basic/arm_mve_defs.td",
207     ],
210 gentbl(
211     name = "basic_riscv_vector_builtins_gen",
212     tbl_outs = [(
213         "-gen-riscv-vector-builtins",
214         "include/clang/Basic/riscv_vector_builtins.inc",
215     )],
216     tblgen = ":clang-tblgen",
217     td_file = "include/clang/Basic/riscv_vector.td",
218     td_srcs = [
219         "include/clang/Basic/riscv_vector.td",
220     ],
223 gentbl(
224     name = "basic_riscv_vector_builtin_cg_gen",
225     tbl_outs = [(
226         "-gen-riscv-vector-builtin-codegen",
227         "include/clang/Basic/riscv_vector_builtin_cg.inc",
228     )],
229     tblgen = ":clang-tblgen",
230     td_file = "include/clang/Basic/riscv_vector.td",
231     td_srcs = [
232         "include/clang/Basic/riscv_vector.td",
233     ],
236 gentbl(
237     name = "basic_arm_cde_gen",
238     tbl_outs = [(
239         "-gen-arm-cde-builtin-def",
240         "include/clang/Basic/arm_cde_builtins.inc",
241     )],
242     tblgen = ":clang-tblgen",
243     td_file = "include/clang/Basic/arm_cde.td",
244     td_srcs = [
245         "include/clang/Basic/arm_cde.td",
246         "include/clang/Basic/arm_mve_defs.td",
247     ],
250 gentbl(
251     name = "basic_arm_cde_aliases_gen",
252     tbl_outs = [(
253         "-gen-arm-cde-builtin-aliases",
254         "include/clang/Basic/arm_cde_builtin_aliases.inc",
255     )],
256     tblgen = ":clang-tblgen",
257     td_file = "include/clang/Basic/arm_cde.td",
258     td_srcs = [
259         "include/clang/Basic/arm_cde.td",
260         "include/clang/Basic/arm_mve_defs.td",
261     ],
264 gentbl(
265     name = "basic_arm_cde_cg_gen",
266     tbl_outs = [(
267         "-gen-arm-cde-builtin-codegen",
268         "include/clang/Basic/arm_cde_builtin_cg.inc",
269     )],
270     tblgen = ":clang-tblgen",
271     td_file = "include/clang/Basic/arm_cde.td",
272     td_srcs = [
273         "include/clang/Basic/arm_cde.td",
274         "include/clang/Basic/arm_mve_defs.td",
275     ],
278 gentbl(
279     name = "basic_arm_cde_sema_gen",
280     tbl_outs = [(
281         "-gen-arm-cde-builtin-sema",
282         "include/clang/Basic/arm_cde_builtin_sema.inc",
283     )],
284     tblgen = ":clang-tblgen",
285     td_file = "include/clang/Basic/arm_cde.td",
286     td_srcs = [
287         "include/clang/Basic/arm_cde.td",
288         "include/clang/Basic/arm_mve_defs.td",
289     ],
292 gentbl(
293     name = "basic_attr_gen",
294     tbl_outs = [
295         (
296             "-gen-clang-attr-has-attribute-impl",
297             "include/clang/Basic/AttrHasAttributeImpl.inc",
298         ),
299         (
300             "-gen-clang-attr-list",
301             "include/clang/Basic/AttrList.inc",
302         ),
303         (
304             "-gen-clang-attr-subject-match-rule-list",
305             "include/clang/Basic/AttrSubMatchRulesList.inc",
306         ),
307     ],
308     tblgen = ":clang-tblgen",
309     td_file = "include/clang/Basic/Attr.td",
310     td_srcs = [
311         "include/clang/Basic/ASTNode.td",
312         "include/clang/Basic/Attr.td",
313         "include/clang/Basic/AttrDocs.td",
314         "include/clang/Basic/DeclNodes.td",
315         "include/clang/Basic/StmtNodes.td",
316     ],
319 gentbl(
320     name = "libsema_openclbuiltins_inc_gen",
321     strip_include_prefix = "lib/Sema",
322     tbl_outs = [(
323         "-gen-clang-opencl-builtins",
324         "lib/Sema/OpenCLBuiltins.inc",
325     )],
326     tblgen = ":clang-tblgen",
327     td_file = "lib/Sema/OpenCLBuiltins.td",
328     td_srcs = [
329         "lib/Sema/OpenCLBuiltins.td",
330     ],
333 # Table definition files can be used for documentation:
334 filegroup(
335     name = "all_table_defs",
336     srcs = glob(["include/**/*.td"]),
339 exports_files(
340     glob(["include/**/*.td"]),
343 genrule(
344     name = "basic_version_gen",
345     outs = ["include/clang/Basic/Version.inc"],
346     cmd = (
347         "echo '#define CLANG_VERSION 14.0.0' >> $@\n" +
348         "echo '#define CLANG_VERSION_MAJOR 14' >> $@\n" +
349         "echo '#define CLANG_VERSION_MINOR 0' >> $@\n" +
350         "echo '#define CLANG_VERSION_PATCHLEVEL 0' >> $@\n" +
351         "echo '#define CLANG_VERSION_STRING \"14.0.0\"' >> $@\n"
352     ),
355 cc_library(
356     name = "config",
357     hdrs = [
358         "include/clang/Basic/Version.inc",
359         "include/clang/Config/config.h",
360     ],
361     includes = ["include"],
362     deps = [
363         # We rely on the LLVM config library to provide configuration defines.
364         "//llvm:config",
365     ],
368 # TODO: This should get replaced with something that actually generates the
369 # correct version number.
370 genrule(
371     name = "vcs_version_gen",
372     # This should be under lib/Basic, but because of how the include paths
373     # are passed through bazel, it's easier to drop generated files next to
374     # the other includes.
375     outs = ["include/VCSVersion.inc"],
376     cmd = "echo '#define CLANG_REVISION \"git\"' > $@",
379 # A hacky library to expose some internal headers of the `basic` library to its
380 # own implementation source files using a stripped include prefix rather than
381 # file-relative-inclusion. This is inherently non-modular as these headers will
382 # be repeated in the sources below for file-relative-inclusion.
383 cc_library(
384     name = "basic_internal_headers",
385     hdrs = glob([
386         "lib/Basic/*.h",
387     ]),
388     features = ["-header_modules"],
389     strip_include_prefix = "lib/Basic",
392 cc_library(
393     name = "basic",
394     srcs = [
395         "include/clang/Basic/Version.inc",
396         "include/VCSVersion.inc",
397     ] + glob([
398         "lib/Basic/*.cpp",
399         "lib/Basic/*.c",
400         "lib/Basic/*.h",
401         "lib/Basic/Targets/*.cpp",
402         "lib/Basic/Targets/*.h",
403     ]),
404     hdrs = glob([
405         "include/clang/Basic/*.h",
406     ]),
407     copts = [
408         "-DHAVE_VCS_VERSION_INC",
409         "$(STACK_FRAME_UNLIMITED)",
410     ],
411     includes = ["include"],
412     textual_hdrs = [
413         "include/clang/Basic/arm_fp16.inc",
414         "include/clang/Basic/arm_mve_builtins.inc",
415         "include/clang/Basic/arm_mve_builtin_aliases.inc",
416         "include/clang/Basic/arm_mve_builtin_cg.inc",
417         "include/clang/Basic/arm_mve_builtin_sema.inc",
418         "include/clang/Basic/arm_neon.inc",
419         "include/clang/Basic/AttrHasAttributeImpl.inc",
420         "include/clang/Basic/AttrList.inc",
421         "include/clang/Basic/AttrSubMatchRulesList.inc",
422         "include/clang/Basic/DiagnosticASTKinds.inc",
423         "include/clang/Basic/DiagnosticGroups.inc",
424         "include/clang/Basic/DiagnosticRefactoringKinds.inc",
425         "include/clang/Basic/DiagnosticAnalysisKinds.inc",
426         "include/clang/Basic/DiagnosticSemaKinds.inc",
427         "include/clang/Basic/DiagnosticCommentKinds.inc",
428         "include/clang/Basic/DiagnosticParseKinds.inc",
429         "include/clang/Basic/DiagnosticLexKinds.inc",
430         "include/clang/Basic/DiagnosticSerializationKinds.inc",
431         "include/clang/Basic/DiagnosticFrontendKinds.inc",
432         "include/clang/Basic/DiagnosticDriverKinds.inc",
433         "include/clang/Basic/DiagnosticCrossTUKinds.inc",
434         "include/clang/Basic/DiagnosticCommonKinds.inc",
435         "include/clang/Basic/DiagnosticIndexName.inc",
436     ] + glob([
437         "include/clang/Basic/*.def",
438     ]),
439     deps = [
440         ":basic_arm_cde_gen",
441         ":basic_arm_fp16_inc_gen",
442         ":basic_arm_mve_aliases_gen",
443         ":basic_arm_mve_cg_gen",
444         ":basic_arm_mve_inc_gen",
445         ":basic_arm_mve_sema_gen",
446         ":basic_arm_neon_inc_gen",
447         ":basic_arm_sve_builtins_gen",
448         ":basic_arm_sve_typeflags_gen",
449         ":basic_attr_gen",
450         ":basic_internal_headers",
451         ":basic_riscv_vector_builtin_cg_gen",
452         ":basic_riscv_vector_builtins_gen",
453         ":config",
454         ":diagnostic_defs_gen",
455         ":sema_attr_gen",
456         "//llvm:Core",
457         "//llvm:FrontendOpenMP",
458         "//llvm:Instrumentation",
459         "//llvm:MC",
460         "//llvm:Support",
461         "//llvm:Target",
462         "//llvm:config",
463     ],
466 cc_library(
467     name = "lex",
468     srcs = glob([
469         "lib/Lex/*.cpp",
470         "lib/Lex/*.h",
471     ]),
472     hdrs = glob([
473         "include/clang/Lex/*.h",
474     ]),
475     includes = ["include"],
476     deps = [
477         ":basic",
478         "//llvm:Support",
479     ],
482 gentbl(
483     name = "ast_attr_gen",
484     tbl_outs = [
485         (
486             "-gen-clang-attr-ast-visitor",
487             "include/clang/AST/AttrVisitor.inc",
488         ),
489         (
490             "-gen-clang-attr-classes",
491             "include/clang/AST/Attrs.inc",
492         ),
493         (
494             "-gen-clang-attr-doc-table",
495             "lib/AST/AttrDocTable.inc",
496         ),
497         (
498             "-gen-clang-attr-text-node-dump",
499             "include/clang/AST/AttrTextNodeDump.inc",
500         ),
501         (
502             "-gen-clang-attr-node-traverse",
503             "include/clang/AST/AttrNodeTraverse.inc",
504         ),
505         (
506             "-gen-clang-attr-impl",
507             "include/clang/AST/AttrImpl.inc",
508         ),
509     ],
510     tblgen = ":clang-tblgen",
511     td_file = "include/clang/Basic/Attr.td",
512     td_srcs = [
513         "include/clang/Basic/Attr.td",
514         "include/clang/Basic/AttrDocs.td",
515         "include/clang/Basic/ASTNode.td",
516         "include/clang/Basic/DeclNodes.td",
517         "include/clang/Basic/StmtNodes.td",
518     ],
521 gentbl(
522     name = "ast_decl_nodes_gen",
523     tbl_outs = [(
524         "-gen-clang-decl-nodes",
525         "include/clang/AST/DeclNodes.inc",
526     )],
527     tblgen = ":clang-tblgen",
528     td_file = "include/clang/Basic/DeclNodes.td",
529     td_srcs = [
530         "include/clang/Basic/ASTNode.td",
531         "include/clang/Basic/DeclNodes.td",
532     ],
535 gentbl(
536     name = "ast_stmt_nodes_gen",
537     tbl_outs = [(
538         "-gen-clang-stmt-nodes",
539         "include/clang/AST/StmtNodes.inc",
540     )],
541     tblgen = ":clang-tblgen",
542     td_file = "include/clang/Basic/StmtNodes.td",
543     td_srcs = [
544         "include/clang/Basic/ASTNode.td",
545         "include/clang/Basic/StmtNodes.td",
546     ],
549 gentbl(
550     name = "ast_comment_nodes_gen",
551     tbl_outs = [(
552         "-gen-clang-comment-nodes",
553         "include/clang/AST/CommentNodes.inc",
554     )],
555     tblgen = ":clang-tblgen",
556     td_file = "include/clang/Basic/CommentNodes.td",
557     td_srcs = [
558         "include/clang/Basic/ASTNode.td",
559         "include/clang/Basic/CommentNodes.td",
560     ],
563 gentbl(
564     name = "ast_comment_command_info_gen",
565     tbl_outs = [
566         (
567             "-gen-clang-comment-command-info",
568             "include/clang/AST/CommentCommandInfo.inc",
569         ),
570         (
571             "-gen-clang-comment-command-list",
572             "include/clang/AST/CommentCommandList.inc",
573         ),
574     ],
575     tblgen = ":clang-tblgen",
576     td_file = "include/clang/AST/CommentCommands.td",
577     td_srcs = ["include/clang/AST/CommentCommands.td"],
580 gentbl(
581     name = "ast_comment_html_tags_gen",
582     tbl_outs = [(
583         "-gen-clang-comment-html-tags",
584         "include/clang/AST/CommentHTMLTags.inc",
585     )],
586     tblgen = ":clang-tblgen",
587     td_file = "include/clang/AST/CommentHTMLTags.td",
588     td_srcs = ["include/clang/AST/CommentHTMLTags.td"],
591 gentbl(
592     name = "ast_comment_html_tags_properties_gen",
593     tbl_outs = [(
594         "-gen-clang-comment-html-tags-properties",
595         "include/clang/AST/CommentHTMLTagsProperties.inc",
596     )],
597     tblgen = ":clang-tblgen",
598     td_file = "include/clang/AST/CommentHTMLTags.td",
599     td_srcs = ["include/clang/AST/CommentHTMLTags.td"],
602 gentbl(
603     name = "ast_comment_html_named_character_references_gen",
604     tbl_outs = [(
605         "-gen-clang-comment-html-named-character-references",
606         "include/clang/AST/CommentHTMLNamedCharacterReferences.inc",
607     )],
608     tblgen = ":clang-tblgen",
609     td_file = "include/clang/AST/CommentHTMLNamedCharacterReferences.td",
610     td_srcs = ["include/clang/AST/CommentHTMLNamedCharacterReferences.td"],
613 gentbl(
614     name = "ast_stmt_data_collectors_gen",
615     tbl_outs = [(
616         "-gen-clang-data-collectors",
617         "include/clang/AST/StmtDataCollectors.inc",
618     )],
619     tblgen = ":clang-tblgen",
620     td_file = "include/clang/AST/StmtDataCollectors.td",
621     td_srcs = ["include/clang/AST/StmtDataCollectors.td"],
624 gentbl(
625     name = "ast_interp_opcodes_gen",
626     tbl_outs = [(
627         "-gen-clang-opcodes",
628         "lib/AST/Interp/Opcodes.inc",
629     )],
630     tblgen = ":clang-tblgen",
631     td_file = "lib/AST/Interp/Opcodes.td",
632     td_srcs = ["lib/AST/Interp/Opcodes.td"],
635 gentbl(
636     name = "ast_properties_base_gen",
637     tbl_outs = [
638         (
639             "-gen-clang-basic-reader",
640             "include/clang/AST/AbstractBasicReader.inc",
641         ),
642         (
643             "-gen-clang-basic-writer",
644             "include/clang/AST/AbstractBasicWriter.inc",
645         ),
646     ],
647     tblgen = ":clang-tblgen",
648     td_file = "include/clang/AST/PropertiesBase.td",
649     td_srcs = ["include/clang/AST/PropertiesBase.td"],
652 gentbl(
653     name = "ast_type_properties_gen",
654     tbl_outs = [
655         (
656             "-gen-clang-type-reader",
657             "include/clang/AST/AbstractTypeReader.inc",
658         ),
659         (
660             "-gen-clang-type-writer",
661             "include/clang/AST/AbstractTypeWriter.inc",
662         ),
663     ],
664     tblgen = ":clang-tblgen",
665     td_file = "include/clang/AST/TypeProperties.td",
666     td_srcs = [
667         "include/clang/AST/PropertiesBase.td",
668         "include/clang/AST/TypeProperties.td",
669         "include/clang/Basic/ASTNode.td",
670         "include/clang/Basic/TypeNodes.td",
671     ],
674 gentbl(
675     name = "type_nodes_gen",
676     tbl_outs = [(
677         "-gen-clang-type-nodes",
678         "include/clang/AST/TypeNodes.inc",
679     )],
680     tblgen = ":clang-tblgen",
681     td_file = "include/clang/Basic/TypeNodes.td",
682     td_srcs = [
683         "include/clang/Basic/ASTNode.td",
684         "include/clang/Basic/TypeNodes.td",
685     ],
688 cc_library(
689     name = "ast",
690     srcs = glob([
691         "lib/AST/*.cpp",
692         "lib/AST/*.h",
693         "lib/AST/Interp/*.cpp",
694         "lib/AST/Interp/*.h",
695     ]),
696     hdrs = glob([
697         "include/clang/AST/*.h",
698     ]),
699     includes = [
700         "include",
701         "lib/AST",
702         "lib/AST/Interp",
703     ],
704     textual_hdrs = [
705         "include/clang/AST/AttrImpl.inc",
706         "include/clang/AST/AttrNodeTraverse.inc",
707         "include/clang/AST/Attrs.inc",
708         "include/clang/AST/AttrTextNodeDump.inc",
709         "include/clang/AST/AttrVisitor.inc",
710         "include/clang/AST/CommentCommandInfo.inc",
711         "include/clang/AST/CommentCommandList.inc",
712         "include/clang/AST/CommentHTMLNamedCharacterReferences.inc",
713         "include/clang/AST/CommentHTMLTags.inc",
714         "include/clang/AST/CommentHTMLTagsProperties.inc",
715         "include/clang/AST/CommentNodes.inc",
716         "include/clang/AST/DeclNodes.inc",
717         "include/clang/AST/StmtDataCollectors.inc",
718         "include/clang/AST/StmtNodes.inc",
719         "lib/AST/AttrDocTable.inc",
720         "lib/AST/Interp/Opcodes.inc",
721     ] + glob([
722         "include/clang/AST/*.def",
723     ]),
724     deps = [
725         ":ast_attr_gen",
726         ":ast_comment_command_info_gen",
727         ":ast_comment_html_named_character_references_gen",
728         ":ast_comment_html_tags_gen",
729         ":ast_comment_html_tags_properties_gen",
730         ":ast_comment_nodes_gen",
731         ":ast_decl_nodes_gen",
732         ":ast_interp_opcodes_gen",
733         ":ast_properties_base_gen",
734         ":ast_stmt_data_collectors_gen",
735         ":ast_stmt_nodes_gen",
736         ":ast_type_properties_gen",
737         ":basic",
738         ":lex",
739         ":type_nodes_gen",
740         "//llvm:BinaryFormat",
741         "//llvm:Core",
742         "//llvm:FrontendOpenMP",
743         "//llvm:Support",
744     ],
747 cc_library(
748     name = "index",
749     srcs = glob([
750         "lib/Index/*.cpp",
751         "lib/Index/*.h",
752     ]),
753     hdrs = glob([
754         "include/clang/Index/*.h",
755         "include/clang-c/*.h",
756     ]),
757     includes = ["include"],
758     deps = [
759         ":ast",
760         ":basic",
761         ":format",
762         ":frontend",
763         ":lex",
764         ":rewrite",
765         ":serialization",
766         "//llvm:Core",
767         "//llvm:Support",
768     ],
771 cc_library(
772     name = "analysis",
773     srcs = glob([
774         "lib/Analysis/*.cpp",
775         "lib/Analysis/*.h",
776     ]),
777     hdrs = glob([
778         "include/clang/Analysis/**/*.h",
779     ]),
780     includes = ["include"],
781     textual_hdrs = glob([
782         "include/clang/Analysis/**/*.def",
783     ]),
784     deps = [
785         ":ast",
786         ":ast_matchers",
787         ":basic",
788         ":lex",
789         "//llvm:Support",
790     ],
793 gentbl(
794     name = "sema_attr_gen",
795     tbl_outs = [
796         (
797             "-gen-clang-attr-parsed-attr-impl",
798             "include/clang/Sema/AttrParsedAttrImpl.inc",
799         ),
800         (
801             "-gen-clang-attr-parsed-attr-kinds",
802             "include/clang/Sema/AttrParsedAttrKinds.inc",
803         ),
804         (
805             "-gen-clang-attr-parsed-attr-list",
806             "include/clang/Sema/AttrParsedAttrList.inc",
807         ),
808         (
809             "-gen-clang-attr-spelling-index",
810             "include/clang/Sema/AttrSpellingListIndex.inc",
811         ),
812         (
813             "-gen-clang-attr-template-instantiate",
814             "include/clang/Sema/AttrTemplateInstantiate.inc",
815         ),
816     ],
817     tblgen = ":clang-tblgen",
818     td_file = "include/clang/Basic/Attr.td",
819     td_srcs = [
820         "include/clang/Basic/ASTNode.td",
821         "include/clang/Basic/Attr.td",
822         "include/clang/Basic/AttrDocs.td",
823         "include/clang/Basic/DeclNodes.td",
824         "include/clang/Basic/StmtNodes.td",
825     ],
828 cc_library(
829     name = "sema",
830     srcs = glob([
831         "lib/Sema/*.cpp",
832         "lib/Sema/*.h",
833     ]),
834     hdrs = glob([
835         "include/clang/Sema/*.h",
836         "include/clang-c/*.h",
837     ]),
838     copts = ["$(STACK_FRAME_UNLIMITED)"],
839     includes = ["include"],
840     textual_hdrs = [
841         "include/clang/Sema/AttrParsedAttrImpl.inc",
842         "include/clang/Sema/AttrParsedAttrKinds.inc",
843         "include/clang/Sema/AttrParsedAttrList.inc",
844         "include/clang/Sema/AttrSpellingListIndex.inc",
845         "include/clang/Sema/AttrTemplateInstantiate.inc",
846         "lib/Sema/OpenCLBuiltins.inc",
847     ],
848     deps = [
849         ":analysis",
850         ":ast",
851         ":basic",
852         ":basic_arm_cde_aliases_gen",
853         ":basic_arm_cde_sema_gen",
854         ":basic_arm_sve_builtins_gen",
855         ":basic_arm_sve_sema_rangechecks_gen",
856         ":edit",
857         ":lex",
858         ":libsema_openclbuiltins_inc_gen",
859         ":sema_attr_gen",
860         ":type_nodes_gen",
861         "//llvm:AllTargetsAsmParsers",
862         "//llvm:AllTargetsCodeGens",
863         "//llvm:Core",
864         "//llvm:FrontendOpenMP",
865         "//llvm:MC",
866         "//llvm:MCParser",
867         "//llvm:Support",
868     ],
871 gentbl(
872     name = "parse_attr_gen",
873     tbl_outs = [
874         (
875             "-gen-clang-attr-parser-string-switches",
876             "include/clang/Parse/AttrParserStringSwitches.inc",
877         ),
878         (
879             "-gen-clang-attr-subject-match-rules-parser-string-switches",
880             "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc",
881         ),
882     ],
883     tblgen = ":clang-tblgen",
884     td_file = "include/clang/Basic/Attr.td",
885     td_srcs = [
886         "include/clang/Basic/ASTNode.td",
887         "include/clang/Basic/Attr.td",
888         "include/clang/Basic/AttrDocs.td",
889         "include/clang/Basic/DeclNodes.td",
890         "include/clang/Basic/StmtNodes.td",
891     ],
894 cc_library(
895     name = "parse",
896     srcs = [
897     ] + glob([
898         "lib/Parse/*.cpp",
899         "lib/Parse/*.h",
900     ]),
901     hdrs = [
902         "include/clang/Parse/AttrParserStringSwitches.inc",
903         "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc",
904     ] + glob(["include/clang/Parse/*.h"]),
905     includes = ["include"],
906     deps = [
907         ":ast",
908         ":basic",
909         ":lex",
910         ":parse_attr_gen",
911         ":sema",
912         "//llvm:FrontendOpenMP",
913         "//llvm:MC",
914         "//llvm:MCParser",
915         "//llvm:Support",
916     ],
919 cc_library(
920     name = "ast_matchers",
921     srcs = glob([
922         "lib/ASTMatchers/*.cpp",
923         "lib/ASTMatchers/*.h",
924     ]),
925     hdrs = glob(["include/clang/ASTMatchers/*.h"]),
926     includes = ["include"],
927     deps = [
928         ":ast",
929         ":basic",
930         ":lex",
931         "//llvm:Support",
932     ],
935 cc_library(
936     name = "ast_matchers_dynamic",
937     srcs = glob([
938         "lib/ASTMatchers/Dynamic/*.cpp",
939         "lib/ASTMatchers/Dynamic/*.h",
940     ]),
941     hdrs = glob(["include/clang/ASTMatchers/Dynamic/*.h"]),
942     copts = ["$(STACK_FRAME_UNLIMITED)"],
943     includes = ["include"],
944     deps = [
945         ":ast",
946         ":ast_matchers",
947         ":basic",
948         "//llvm:FrontendOpenMP",
949         "//llvm:Support",
950     ],
953 cc_library(
954     name = "rewrite",
955     srcs = glob([
956         "lib/Rewrite/*.cpp",
957         "lib/Rewrite/*.h",
958     ]),
959     hdrs = glob(["include/clang/Rewrite/Core/*.h"]),
960     includes = ["include"],
961     deps = [
962         ":ast",
963         ":basic",
964         ":edit",
965         ":lex",
966         "//llvm:Support",
967     ],
970 cc_library(
971     name = "testing",
972     srcs = glob([
973         "lib/Testing/*.cpp",
974     ]),
975     hdrs = glob(["include/clang/Testing/*.h"]),
976     includes = ["include"],
977     deps = [
978         ":basic",
979         "//llvm:Support",
980     ],
983 cc_library(
984     name = "tooling_core",
985     srcs = glob([
986         "lib/Tooling/Core/*.cpp",
987         "lib/Tooling/Core/*.h",
988     ]),
989     hdrs = glob(["include/clang/Tooling/Core/*.h"]),
990     includes = ["include"],
991     deps = [
992         ":ast",
993         ":basic",
994         ":lex",
995         ":rewrite",
996         "//llvm:Support",
997     ],
1000 cc_library(
1001     name = "tooling",
1002     srcs = glob(
1003         [
1004             "lib/Tooling/*.cpp",
1005         ],
1006         # Temporarily disable until we support the generated file.
1007         exclude = ["lib/Tooling/NodeIntrospection.cpp"],
1008     ),
1009     hdrs = glob([
1010         "include/clang/Tooling/*.h",
1011     ]),
1012     includes = ["include"],
1013     deps = [
1014         ":ast",
1015         ":ast_matchers",
1016         ":basic",
1017         ":driver",
1018         ":format",
1019         ":frontend",
1020         ":lex",
1021         ":rewrite",
1022         ":tooling_core",
1023         "//llvm:Option",
1024         "//llvm:Support",
1025     ],
1028 cc_library(
1029     name = "tooling_inclusions",
1030     srcs = glob([
1031         "lib/Tooling/Inclusions/**/*.cpp",
1032     ]),
1033     hdrs = glob([
1034         "include/clang/Tooling/Inclusions/**/*.h",
1035     ]),
1036     deps = [
1037         ":basic",
1038         ":lex",
1039         ":rewrite",
1040         ":tooling_core",
1041         "//llvm:Support",
1042     ],
1045 cc_library(
1046     name = "tooling_refactoring",
1047     srcs = glob([
1048         "lib/Tooling/Refactoring/**/*.cpp",
1049         "lib/Tooling/Refactoring/**/*.h",
1050     ]),
1051     hdrs = glob([
1052         "include/clang/Tooling/Refactoring/**/*.h",
1053         "include/clang/Tooling/Refactoring/**/*.def",
1054     ]),
1055     deps = [
1056         ":ast",
1057         ":ast_matchers",
1058         ":basic",
1059         ":format",
1060         ":frontend",
1061         ":index",
1062         ":lex",
1063         ":rewrite",
1064         ":tooling",
1065         ":tooling_core",
1066         "//llvm:Support",
1067     ],
1070 gentbl(
1071     name = "tooling_syntax_gen",
1072     tbl_outs = [
1073         ("-gen-clang-syntax-node-list", "include/clang/Tooling/Syntax/Nodes.inc"),
1074         ("-gen-clang-syntax-node-classes", "include/clang/Tooling/Syntax/NodeClasses.inc"),
1075     ],
1076     tblgen = ":clang-tblgen",
1077     td_file = "include/clang/Tooling/Syntax/Nodes.td",
1078     td_srcs = [
1079         "include/clang/Tooling/Syntax/Nodes.td",
1080         "include/clang/Tooling/Syntax/Syntax.td",
1081     ],
1084 cc_library(
1085     name = "tooling_syntax",
1086     srcs = glob(["lib/Tooling/Syntax/**/*.cpp"]),
1087     hdrs = glob(["include/clang/Tooling/Syntax/**/*.h"]),
1088     deps = [
1089         ":ast",
1090         ":basic",
1091         ":lex",
1092         ":tooling_core",
1093         ":tooling_syntax_gen",
1094         "//llvm:Support",
1095     ],
1098 cc_library(
1099     name = "tooling_dependency_scanning",
1100     srcs = glob(["lib/Tooling/DependencyScanning/**/*.cpp"]),
1101     hdrs = glob(["include/clang/Tooling/DependencyScanning/**/*.h"]),
1102     deps = [
1103         ":basic",
1104         ":codegen",
1105         ":frontend",
1106         ":lex",
1107         ":serialization",
1108         ":tooling",
1109         "//llvm:Support",
1110     ],
1113 cc_library(
1114     name = "transformer",
1115     srcs = glob(["lib/Tooling/Transformer/**/*.cpp"]),
1116     hdrs = glob(["include/clang/Tooling/Transformer/**/*.h"]),
1117     deps = [
1118         ":ast",
1119         ":ast_matchers",
1120         ":basic",
1121         ":lex",
1122         ":rewrite",
1123         ":tooling_refactoring",
1124         "//llvm:Support",
1125     ],
1128 cc_library(
1129     name = "ast-diff",
1130     srcs = glob(["lib/Tooling/ASTDiff/*.cpp"]),
1131     hdrs = glob(["include/clang/Tooling/ASTDiff/*.h"]),
1132     deps = [
1133         ":ast",
1134         ":basic",
1135         ":lex",
1136         "//llvm:Support",
1137     ],
1140 cc_library(
1141     name = "crosstu",
1142     srcs = glob(["lib/CrossTU/*.cpp"]),
1143     hdrs = glob(["include/clang/CrossTU/*.h"]),
1144     deps = [
1145         ":ast",
1146         ":basic",
1147         ":frontend",
1148         ":index",
1149         "//llvm:Option",
1150         "//llvm:Support",
1151     ],
1154 cc_library(
1155     name = "format",
1156     srcs = glob(
1157         [
1158             "lib/Format/*.cpp",
1159             "lib/Format/*.h",
1160         ],
1161     ),
1162     hdrs = [
1163         "lib/Format/FormatTokenLexer.h",
1164         "lib/Format/Macros.h",
1165     ] + glob([
1166         "include/clang/Format/*.h",
1167     ]),
1168     includes = ["include"],
1169     deps = [
1170         ":basic",
1171         ":lex",
1172         ":tooling_core",
1173         ":tooling_inclusions",
1174         "//llvm:Support",
1175     ],
1178 cc_library(
1179     name = "edit",
1180     srcs = glob(["lib/Edit/*.cpp"]),
1181     hdrs = glob(["include/clang/Edit/*.h"]),
1182     includes = ["include"],
1183     deps = [
1184         ":ast",
1185         ":basic",
1186         ":lex",
1187         "//llvm:Support",
1188     ],
1191 cc_library(
1192     name = "static_analyzer_core_options",
1193     hdrs = [
1194         "include/clang/StaticAnalyzer/Core/AnalyzerOptions.h",
1195     ],
1196     textual_hdrs = [
1197         "include/clang/StaticAnalyzer/Core/Analyses.def",
1198         "include/clang/StaticAnalyzer/Core/AnalyzerOptions.def",
1199     ],
1200     deps = [
1201         ":basic",
1202         ":static_analyzer_checkers_gen",
1203         "//llvm:Support",
1204     ],
1207 cc_library(
1208     name = "static_analyzer_core",
1209     srcs = glob([
1210         "lib/StaticAnalyzer/Core/**/*.cpp",
1211         "lib/StaticAnalyzer/Core/**/*.h",
1212     ]),
1213     hdrs = glob([
1214         "include/clang/StaticAnalyzer/Core/**/*.h",
1215     ]),
1216     includes = ["include"],
1217     textual_hdrs = glob([
1218         "include/clang/StaticAnalyzer/Core/**/*.def",
1219     ]),
1220     deps = [
1221         ":analysis",
1222         ":ast",
1223         ":ast_matchers",
1224         ":basic",
1225         ":crosstu",
1226         ":driver",
1227         ":frontend",
1228         ":lex",
1229         ":rewrite",
1230         ":static_analyzer_checkers_gen",
1231         ":tooling",
1232         ":tooling_core",
1233         "//llvm:Support",
1234     ],
1237 gentbl(
1238     name = "static_analyzer_checkers_gen",
1239     tbl_outs = [(
1240         "-gen-clang-sa-checkers",
1241         "include/clang/StaticAnalyzer/Checkers/Checkers.inc",
1242     )],
1243     tblgen = ":clang-tblgen",
1244     td_file = "include/clang/StaticAnalyzer/Checkers/Checkers.td",
1245     td_srcs = [
1246         "include/clang/StaticAnalyzer/Checkers/CheckerBase.td",
1247         "include/clang/StaticAnalyzer/Checkers/Checkers.td",
1248     ],
1251 cc_library(
1252     name = "static_analyzer_checkers",
1253     srcs = glob([
1254         "lib/StaticAnalyzer/Checkers/**/*.cpp",
1255         "lib/StaticAnalyzer/Checkers/**/*.h",
1256     ]),
1257     hdrs = [
1258         "include/clang/StaticAnalyzer/Checkers/Checkers.inc",
1259     ] + glob([
1260         "include/clang/StaticAnalyzer/Checkers/**/*.h",
1261     ]),
1262     copts = ["$(STACK_FRAME_UNLIMITED)"],
1263     includes = ["include"],
1264     deps = [
1265         ":analysis",
1266         ":ast",
1267         ":ast_matchers",
1268         ":basic",
1269         ":driver",
1270         ":lex",
1271         ":static_analyzer_checkers_gen",
1272         ":static_analyzer_core",
1273         "//llvm:Support",
1274     ],
1277 gentbl(
1278     name = "driver_options_inc_gen",
1279     tbl_outs = [(
1280         "-gen-opt-parser-defs",
1281         "include/clang/Driver/Options.inc",
1282     )],
1283     tblgen = "//llvm:llvm-tblgen",
1284     td_file = "include/clang/Driver/Options.td",
1285     td_srcs = [
1286         "//llvm:include/llvm/Option/OptParser.td",
1287     ],
1290 cc_library(
1291     name = "driver",
1292     srcs = glob(
1293         [
1294             "lib/Driver/*.cpp",
1295             "lib/Driver/*.h",
1296             "lib/Driver/Arch/*.cpp",
1297             "lib/Driver/Arch/*.h",
1298             "lib/Driver/ToolChains/*.cpp",
1299             "lib/Driver/ToolChains/*.h",
1300             "lib/Driver/ToolChains/Arch/*.cpp",
1301             "lib/Driver/ToolChains/Arch/*.h",
1302         ],
1303         exclude = [
1304             "lib/Driver/ToolChains/MSVCSetupApi.h",
1305         ],
1306     ),
1307     hdrs = glob([
1308         "include/clang/Driver/*.h",
1309     ]),
1310     copts = ["$(STACK_FRAME_UNLIMITED)"],
1311     includes = [
1312         "include",
1313         # TODO: This is likely a layering issue, but files in Arch are currently
1314         # directly #including "Tools.h".
1315         "lib/Driver",
1316     ],
1317     textual_hdrs = glob([
1318         "include/clang/Driver/*.def",
1319     ]),
1320     deps = [
1321         ":ast",
1322         ":basic",
1323         ":config",
1324         ":driver_options_inc_gen",
1325         ":parse",
1326         ":static_analyzer_checkers_gen",
1327         "//llvm:BinaryFormat",
1328         "//llvm:MC",
1329         "//llvm:Option",
1330         "//llvm:ProfileData",
1331         "//llvm:Support",
1332         "//llvm:Target",
1333         "//llvm:config",
1334     ],
1337 gentbl(
1338     name = "headers_arm_neon_gen",
1339     tbl_outs = [(
1340         "-gen-arm-neon",
1341         "lib/Headers/arm_neon.h",
1342     )],
1343     tblgen = ":clang-tblgen",
1344     td_file = "include/clang/Basic/arm_neon.td",
1345     td_srcs = [
1346         "include/clang/Basic/arm_neon.td",
1347         "include/clang/Basic/arm_neon_incl.td",
1348     ],
1351 gentbl(
1352     name = "headers_arm_fp16_gen",
1353     tbl_outs = [(
1354         "-gen-arm-fp16",
1355         "lib/Headers/arm_fp16.h",
1356     )],
1357     tblgen = ":clang-tblgen",
1358     td_file = "include/clang/Basic/arm_fp16.td",
1359     td_srcs = [
1360         "include/clang/Basic/arm_fp16.td",
1361         "include/clang/Basic/arm_neon_incl.td",
1362     ],
1365 gentbl(
1366     name = "headers_arm_mve_gen",
1367     tbl_outs = [(
1368         "-gen-arm-mve-header",
1369         "lib/Headers/arm_mve.h",
1370     )],
1371     tblgen = ":clang-tblgen",
1372     td_file = "include/clang/Basic/arm_mve.td",
1373     td_srcs = [
1374         "include/clang/Basic/arm_mve.td",
1375         "include/clang/Basic/arm_mve_defs.td",
1376     ],
1379 gentbl(
1380     name = "headers_arm_cde_gen",
1381     tbl_outs = [(
1382         "-gen-arm-cde-header",
1383         "lib/Headers/arm_cde.h",
1384     )],
1385     tblgen = ":clang-tblgen",
1386     td_file = "include/clang/Basic/arm_cde.td",
1387     td_srcs = [
1388         "include/clang/Basic/arm_cde.td",
1389         "include/clang/Basic/arm_mve_defs.td",
1390     ],
1393 gentbl(
1394     name = "headers_arm_sve_gen",
1395     tbl_outs = [(
1396         "-gen-arm-sve-header",
1397         "lib/Headers/arm_sve.h",
1398     )],
1399     tblgen = ":clang-tblgen",
1400     td_file = "include/clang/Basic/arm_sve.td",
1401     td_srcs = [
1402         "include/clang/Basic/arm_sve.td",
1403     ],
1406 gentbl(
1407     name = "headers_arm_bf16_gen",
1408     tbl_outs = [(
1409         "-gen-arm-bf16",
1410         "lib/Headers/arm_bf16.h",
1411     )],
1412     tblgen = ":clang-tblgen",
1413     td_file = "include/clang/Basic/arm_bf16.td",
1414     td_srcs = [
1415         "include/clang/Basic/arm_bf16.td",
1416         "include/clang/Basic/arm_neon_incl.td",
1417     ],
1420 gentbl(
1421     name = "headers_riscv_vector",
1422     tbl_outs = [(
1423         "-gen-riscv-vector-header",
1424         "lib/Headers/riscv_vector.h",
1425     )],
1426     tblgen = ":clang-tblgen",
1427     td_file = "include/clang/Basic/riscv_vector.td",
1428     td_srcs = [
1429         "include/clang/Basic/riscv_vector.td",
1430     ],
1433 # We generate the set of builtin headers under a special subdirectory in the
1434 # 'bin' section of the bazel output so that they can be used as data
1435 # dependencies. It requires listing explicitly all the generated inputs here.
1436 builtin_headers = glob(["lib/Headers/**/*.h"]) + [
1437     "lib/Headers/arm_cde.h",
1438     "lib/Headers/arm_fp16.h",
1439     "lib/Headers/arm_mve.h",
1440     "lib/Headers/arm_neon.h",
1441     "lib/Headers/arm_sve.h",
1442     "lib/Headers/arm_bf16.h",
1443     "lib/Headers/riscv_vector.h",
1446 genrule(
1447     name = "builtin_headers_gen",
1448     srcs = builtin_headers,
1449     outs = [hdr.replace("lib/Headers/", "staging/include/") for hdr in builtin_headers],
1450     cmd = """
1451        for src in $(SRCS); do
1452          relsrc=$${src/*external\\/llvm-project\\/clang\\/lib\\/Headers\\/}
1453          target=$(@D)/staging/include/$$relsrc
1454          mkdir -p $$(dirname $$target)
1455          cp $$src $$target
1456        done""",
1457     output_to_bindir = 1,
1460 cc_library(
1461     name = "frontend",
1462     srcs = glob([
1463         "lib/Frontend/*.cpp",
1464         "lib/Frontend/*.h",
1465     ]),
1466     hdrs = glob([
1467         "include/clang/Frontend/*.h",
1468     ]),
1469     copts = ["$(STACK_FRAME_UNLIMITED)"],
1470     data = [":builtin_headers_gen"],
1471     includes = ["include"],
1472     textual_hdrs = glob([
1473         "include/clang/Frontend/*.def",
1474     ]),
1475     deps = [
1476         ":ast",
1477         ":basic",
1478         ":config",
1479         ":driver",
1480         ":driver_options_inc_gen",
1481         ":edit",
1482         ":lex",
1483         ":parse",
1484         ":sema",
1485         ":serialization",
1486         ":static_analyzer_core_options",
1487         "//llvm:BinaryFormat",
1488         "//llvm:BitReader",
1489         "//llvm:BitstreamReader",
1490         "//llvm:BitstreamWriter",
1491         "//llvm:Core",
1492         "//llvm:Linker",
1493         "//llvm:MC",
1494         "//llvm:Option",
1495         "//llvm:ProfileData",
1496         "//llvm:Support",
1497         "//llvm:Target",
1498         "//llvm:config",
1499     ],
1502 cc_library(
1503     name = "frontend_rewrite",
1504     srcs = glob([
1505         "lib/Frontend/Rewrite/*.cpp",
1506         "lib/Frontend/Rewrite/*.h",
1507     ]),
1508     hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]),
1509     includes = ["include"],
1510     deps = [
1511         ":ast",
1512         ":basic",
1513         ":config",
1514         ":edit",
1515         ":frontend",
1516         ":lex",
1517         ":parse",
1518         ":rewrite",
1519         ":serialization",
1520         "//llvm:Support",
1521     ],
1524 cc_library(
1525     name = "interpreter",
1526     srcs = glob([
1527         "lib/Interpreter/*.cpp",
1528         "lib/Interpreter/*.h",
1529     ]),
1530     hdrs = glob(["include/clang/Interpreter/*.h"]),
1531     includes = ["include"],
1532     deps = [
1533         ":analysis",
1534         ":ast",
1535         ":basic",
1536         ":codegen",
1537         ":driver",
1538         ":edit",
1539         ":frontend",
1540         ":frontend_tool",
1541         ":lex",
1542         ":parse",
1543         ":sema",
1544         ":serialization",
1545         "//llvm:AllTargetsAsmParsers",
1546         "//llvm:AllTargetsCodeGens",
1547         "//llvm:Core",
1548         "//llvm:ExecutionEngine",
1549         "//llvm:Option",
1550         "//llvm:OrcJIT",
1551         "//llvm:Support",
1552         "//llvm:Target",
1553     ],
1556 cc_library(
1557     name = "codegen",
1558     srcs = glob([
1559         "lib/CodeGen/*.cpp",
1560         "lib/CodeGen/*.h",
1561     ]),
1562     hdrs = glob(["include/clang/CodeGen/*.h"]),
1563     copts = ["$(STACK_FRAME_UNLIMITED)"],
1564     includes = ["include"],
1565     deps = [
1566         ":analysis",
1567         ":ast",
1568         ":basic",
1569         ":basic_arm_cde_cg_gen",
1570         ":basic_arm_sve_builtin_cg_gen",
1571         ":basic_riscv_vector_builtin_cg_gen",
1572         ":driver",
1573         ":frontend",
1574         ":lex",
1575         ":sema",
1576         ":type_nodes_gen",
1577         "//llvm:AllTargetsAsmParsers",
1578         "//llvm:Analysis",
1579         "//llvm:BitReader",
1580         "//llvm:BitWriter",
1581         "//llvm:BitstreamReader",
1582         "//llvm:CodeGen",
1583         "//llvm:Core",
1584         "//llvm:Coroutines",
1585         "//llvm:Coverage",
1586         "//llvm:DebugInfoDWARF",
1587         "//llvm:FrontendOpenMP",
1588         "//llvm:IPO",
1589         "//llvm:IRReader",
1590         "//llvm:InstCombine",
1591         "//llvm:Instrumentation",
1592         "//llvm:LTO",
1593         "//llvm:Linker",
1594         "//llvm:MC",
1595         "//llvm:ObjCARC",
1596         "//llvm:Object",
1597         "//llvm:Passes",
1598         "//llvm:ProfileData",
1599         "//llvm:Scalar",
1600         "//llvm:Support",
1601         "//llvm:Target",
1602         "//llvm:TransformUtils",
1603     ],
1606 cc_library(
1607     name = "static_analyzer_frontend",
1608     srcs = glob([
1609         "lib/StaticAnalyzer/Frontend/**/*.cpp",
1610         "lib/StaticAnalyzer/Frontend/**/*.h",
1611     ]),
1612     hdrs = glob(["include/clang/StaticAnalyzer/Frontend/**/*.h"]),
1613     includes = ["include"],
1614     deps = [
1615         ":analysis",
1616         ":ast",
1617         ":basic",
1618         ":crosstu",
1619         ":driver",
1620         ":frontend",
1621         ":lex",
1622         ":rewrite",
1623         ":serialization",
1624         ":static_analyzer_checkers",
1625         ":static_analyzer_core",
1626         ":tooling",
1627         ":tooling_core",
1628         "//llvm:Support",
1629     ],
1632 gentbl(
1633     name = "serialization_attr_gen",
1634     tbl_outs = [
1635         (
1636             "-gen-clang-attr-pch-read",
1637             "include/clang/Serialization/AttrPCHRead.inc",
1638         ),
1639         (
1640             "-gen-clang-attr-pch-write",
1641             "include/clang/Serialization/AttrPCHWrite.inc",
1642         ),
1643     ],
1644     tblgen = ":clang-tblgen",
1645     td_file = "include/clang/Basic/Attr.td",
1646     td_srcs = [
1647         "include/clang/Basic/ASTNode.td",
1648         "include/clang/Basic/Attr.td",
1649         "include/clang/Basic/AttrDocs.td",
1650         "include/clang/Basic/DeclNodes.td",
1651         "include/clang/Basic/StmtNodes.td",
1652     ],
1655 cc_library(
1656     name = "serialization",
1657     srcs = [
1658         "include/clang/Serialization/AttrPCHRead.inc",
1659         "include/clang/Serialization/AttrPCHWrite.inc",
1660     ] + glob([
1661         "lib/Serialization/*.cpp",
1662         "lib/Serialization/*.h",
1663     ]),
1664     hdrs = glob([
1665         "include/clang/Serialization/*.h",
1666     ]),
1667     includes = ["include"],
1668     textual_hdrs = glob([
1669         "include/clang/Serialization/*.def",
1670     ]),
1671     deps = [
1672         ":ast",
1673         ":basic",
1674         ":lex",
1675         ":sema",
1676         ":serialization_attr_gen",
1677         ":type_nodes_gen",
1678         "//llvm:BitReader",
1679         "//llvm:BitWriter",
1680         "//llvm:BitstreamReader",
1681         "//llvm:BitstreamWriter",
1682         "//llvm:FrontendOpenMP",
1683         "//llvm:Support",
1684     ],
1687 cc_library(
1688     name = "frontend_tool",
1689     srcs = glob([
1690         "lib/FrontendTool/*.cpp",
1691         "lib/FrontendTool/*.h",
1692     ]),
1693     hdrs = glob(["include/clang/FrontendTool/*.h"]),
1694     includes = ["include"],
1695     deps = [
1696         ":arc_migrate",
1697         ":codegen",
1698         ":config",
1699         ":driver",
1700         ":frontend",
1701         ":frontend_rewrite",
1702         ":static_analyzer_frontend",
1703         "//llvm:Option",
1704         "//llvm:Support",
1705     ],
1708 cc_library(
1709     name = "arc_migrate",
1710     srcs = glob([
1711         "lib/ARCMigrate/*.cpp",
1712         "lib/ARCMigrate/*.h",
1713     ]),
1714     hdrs = glob(["include/clang/ARCMigrate/*.h"]),
1715     includes = ["include"],
1716     deps = [
1717         ":analysis",
1718         ":ast",
1719         ":basic",
1720         ":edit",
1721         ":frontend",
1722         ":frontend_rewrite",
1723         ":lex",
1724         ":parse",
1725         ":rewrite",
1726         ":sema",
1727         ":serialization",
1728         ":static_analyzer_checkers",
1729         ":static_analyzer_core",
1730         "//llvm:Support",
1731     ],
1734 cc_library(
1735     name = "libclang_library",
1736     srcs = glob([
1737         "tools/libclang/*.cpp",
1738         "tools/libclang/*.h",
1739     ]),
1740     hdrs = glob(["include/clang-c/*.h"]),
1741     deps = [
1742         ":arc_migrate",
1743         ":ast",
1744         ":basic",
1745         ":codegen",
1746         ":config",
1747         ":driver",
1748         ":frontend",
1749         ":index",
1750         ":lex",
1751         ":rewrite",
1752         ":sema",
1753         ":tooling",
1754         "//llvm:BitstreamReader",
1755         "//llvm:FrontendOpenMP",
1756         "//llvm:Support",
1757         "//llvm:config",
1758     ],
1761 cc_library(
1762     name = "c-bindings",
1763     hdrs = glob(["include/clang-c/*.h"]),
1764     deps = [
1765         ":libclang_library",
1766     ],
1767     alwayslink = 1,
1770 cc_plugin_library(
1771     name = "libclang",
1772     deps = [":c-bindings"],
1775 filegroup(
1776     name = "python-sources",
1777     srcs = [
1778         "bindings/python/clang/cindex.py",
1779         "bindings/python/clang/enumerations.py",
1780     ],
1783 filegroup(
1784     name = "python-cindex-examples",
1785     srcs = [
1786         "bindings/python/examples/cindex/cindex-dump.py",
1787         "bindings/python/examples/cindex/cindex-includes.py",
1788     ],
1791 cc_binary(
1792     name = "c-index-test",
1793     testonly = 1,
1794     srcs = [
1795         "tools/c-index-test/c-index-test.c",
1796         "tools/c-index-test/core_main.cpp",
1797     ],
1798     copts = [
1799         "-Wno-uninitialized",
1800     ],
1801     stamp = 0,
1802     deps = [
1803         ":ast",
1804         ":basic",
1805         ":c-bindings",
1806         ":codegen",
1807         ":config",
1808         ":frontend",
1809         ":index",
1810         ":lex",
1811         ":parse",
1812         ":sema",
1813         ":serialization",
1814         "//llvm:Core",
1815         "//llvm:MC",
1816         "//llvm:Support",
1817     ],
1820 cc_binary(
1821     name = "arcmt-test",
1822     testonly = 1,
1823     srcs = ["tools/arcmt-test/arcmt-test.cpp"],
1824     stamp = 0,
1825     deps = [
1826         ":arc_migrate",
1827         ":ast",
1828         ":basic",
1829         ":frontend",
1830         ":frontend_rewrite",
1831         ":lex",
1832         "//llvm:Support",
1833     ],
1836 cc_binary(
1837     name = "c-arcmt-test",
1838     testonly = 1,
1839     srcs = ["tools/c-arcmt-test/c-arcmt-test.c"],
1840     copts = ["-std=gnu99"],
1841     stamp = 0,
1842     deps = [
1843         ":c-bindings",
1844         ":codegen",
1845         "//llvm:MC",
1846         "//llvm:Support",
1847     ],
1850 cc_binary(
1851     name = "clang-import-test",
1852     testonly = 1,
1853     srcs = glob([
1854         "tools/clang-import-test/*.cpp",
1855         "tools/clang-import-test/*.h",
1856     ]),
1857     stamp = 0,
1858     deps = [
1859         ":ast",
1860         ":basic",
1861         ":codegen",
1862         ":driver",
1863         ":frontend",
1864         ":lex",
1865         ":parse",
1866         "//llvm:Core",
1867         "//llvm:Support",
1868     ],
1871 cc_library(
1872     name = "clang-driver",
1873     srcs = glob([
1874         "tools/driver/*.cpp",
1875         "tools/driver/*.h",
1876     ]),
1877     copts = [
1878         # Disable stack frame size checks in the driver because
1879         # clang::ensureStackAddressSpace allocates a large array on the stack.
1880         "$(STACK_FRAME_UNLIMITED)",
1881     ],
1882     deps = [
1883         ":analysis",
1884         ":ast",
1885         ":basic",
1886         ":codegen",
1887         ":config",
1888         ":driver",
1889         ":frontend",
1890         ":frontend_rewrite",
1891         ":frontend_tool",
1892         ":lex",
1893         ":parse",
1894         ":sema",
1895         ":serialization",
1896         ":static_analyzer_frontend",
1897         "//llvm:AllTargetsAsmParsers",
1898         "//llvm:AllTargetsCodeGens",
1899         "//llvm:BitReader",
1900         "//llvm:BitWriter",
1901         "//llvm:CodeGen",
1902         "//llvm:Core",
1903         "//llvm:IPO",
1904         "//llvm:MC",
1905         "//llvm:MCParser",
1906         "//llvm:Option",
1907         "//llvm:Support",
1908         "//llvm:Target",
1909         "//llvm:config",
1910     ],
1913 cc_binary(
1914     name = "clang",
1915     srcs = [],
1916     stamp = 0,
1917     deps = [
1918         ":clang-driver",
1919     ],
1922 cc_binary(
1923     name = "diagtool",
1924     srcs = glob([
1925         "tools/diagtool/*.cpp",
1926         "tools/diagtool/*.h",
1927     ]),
1928     stamp = 0,
1929     deps = [
1930         ":basic",
1931         ":frontend",
1932         ":lex",
1933         ":sema",
1934         "//llvm:Support",
1935     ],
1938 filegroup(
1939     name = "exploded_graph_rewriter",
1940     testonly = 1,
1941     data = ["utils/analyzer/exploded-graph-rewriter.py"],
1944 filegroup(
1945     name = "module-deps-to-rsp",
1946     testonly = 1,
1947     data = ["utils/module-deps-to-rsp.py"],
1950 filegroup(
1951     name = "hmaptool",
1952     testonly = 1,
1953     data = ["utils/hmaptool/hmaptool"],
1956 binary_alias(
1957     name = "clang++",
1958     binary = ":clang",
1961 cc_binary(
1962     name = "clang-check",
1963     srcs = ["tools/clang-check/ClangCheck.cpp"],
1964     stamp = 0,
1965     deps = [
1966         ":ast",
1967         ":codegen",
1968         ":driver",
1969         ":frontend",
1970         ":frontend_rewrite",
1971         ":serialization",
1972         ":static_analyzer_frontend",
1973         ":tooling",
1974         ":tooling_syntax",
1975         "//llvm:Option",
1976         "//llvm:Support",
1977     ],
1980 cc_binary(
1981     name = "clang-format",
1982     srcs = [
1983         "tools/clang-format/ClangFormat.cpp",
1984     ],
1985     stamp = 0,
1986     deps = [
1987         ":basic",
1988         ":format",
1989         ":frontend",
1990         ":rewrite",
1991         "//llvm:Support",
1992     ],
1995 cc_binary(
1996     name = "clang-diff",
1997     srcs = glob(["tools/clang-diff/*.cpp"]),
1998     stamp = 0,
1999     deps = [
2000         ":ast-diff",
2001         ":tooling",
2002         "//llvm:Support",
2003     ],
2006 cc_binary(
2007     name = "clang-offload-bundler",
2008     srcs = glob(["tools/clang-offload-bundler/*.cpp"]),
2009     stamp = 0,
2010     deps = [
2011         ":basic",
2012         ":tooling",
2013         "//llvm:BitWriter",
2014         "//llvm:Core",
2015         "//llvm:Object",
2016         "//llvm:Support",
2017     ],
2020 cc_binary(
2021     name = "clang-offload-wrapper",
2022     srcs = glob(["tools/clang-offload-wrapper/*.cpp"]),
2023     stamp = 0,
2024     deps = [
2025         ":basic",
2026         "//llvm:BitWriter",
2027         "//llvm:Support",
2028         "//llvm:TransformUtils",
2029         "//llvm:ir_headers",
2030     ],
2033 cc_binary(
2034     name = "clang-refactor",
2035     srcs = glob([
2036         "tools/clang-refactor/*.cpp",
2037         "tools/clang-refactor/*.h",
2038     ]),
2039     stamp = 0,
2040     deps = [
2041         ":ast",
2042         ":basic",
2043         ":format",
2044         ":frontend",
2045         ":lex",
2046         ":rewrite",
2047         ":tooling",
2048         ":tooling_refactoring",
2049         "//llvm:Support",
2050     ],
2053 cc_binary(
2054     name = "clang-rename",
2055     srcs = glob(["tools/clang-rename/*.cpp"]),
2056     stamp = 0,
2057     deps = [
2058         ":basic",
2059         ":frontend",
2060         ":rewrite",
2061         ":tooling",
2062         ":tooling_refactoring",
2063         "//llvm:Support",
2064     ],
2067 cc_binary(
2068     name = "clang-repl",
2069     srcs = glob(["tools/clang-repl/*.cpp"]),
2070     stamp = 0,
2071     deps = [
2072         ":basic",
2073         ":frontend",
2074         ":interpreter",
2075         ":tooling",
2076         "//llvm:Core",
2077         "//llvm:LineEditor",
2078         "//llvm:Option",
2079         "//llvm:OrcJIT",
2080         "//llvm:Support",
2081     ],
2084 cc_binary(
2085     name = "clang-extdef-mapping",
2086     srcs = glob(["tools/clang-extdef-mapping/*.cpp"]),
2087     stamp = 0,
2088     deps = [
2089         ":ast",
2090         ":basic",
2091         ":crosstu",
2092         ":frontend",
2093         ":tooling",
2094         "//llvm:Support",
2095     ],
2098 cc_binary(
2099     name = "clang-scan-deps",
2100     srcs = glob(["tools/clang-scan-deps/*.cpp"]),
2101     stamp = 0,
2102     deps = [
2103         ":frontend",
2104         ":tooling",
2105         ":tooling_dependency_scanning",
2106         "//llvm:Support",
2107     ],