BUILD 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("//bazel/cc_rules:defs.bzl", "cc_library", "cc_test")
  5. package(default_visibility = ["//visibility:public"])
  6. cc_library(
  7. name = "typed_insts",
  8. srcs = [
  9. "ids.cpp",
  10. "inst_kind.cpp",
  11. ],
  12. hdrs = [
  13. "id_kind.h",
  14. "ids.h",
  15. "inst_categories.h",
  16. "inst_kind.h",
  17. "singleton_insts.h",
  18. "specific_interface.h",
  19. "typed_insts.h",
  20. ],
  21. textual_hdrs = ["inst_kind.def"],
  22. deps = [
  23. "//common:check",
  24. "//common:enum_base",
  25. "//common:ostream",
  26. "//common:template_string",
  27. "//common:type_enum",
  28. "//toolchain/base:canonical_value_store",
  29. "//toolchain/base:index_base",
  30. "//toolchain/base:int",
  31. "//toolchain/base:value_ids",
  32. "//toolchain/diagnostics:diagnostic_emitter",
  33. "//toolchain/parse:node_kind",
  34. "@llvm-project//llvm:Support",
  35. ],
  36. )
  37. cc_test(
  38. name = "ids_test",
  39. srcs = ["ids_test.cpp"],
  40. deps = [
  41. ":typed_insts",
  42. "//testing/base:gtest_main",
  43. "@googletest//:gtest",
  44. ],
  45. )
  46. cc_library(
  47. name = "clang_decl",
  48. srcs = ["clang_decl.cpp"],
  49. hdrs = ["clang_decl.h"],
  50. deps = [
  51. ":typed_insts",
  52. "//common:hashtable_key_context",
  53. "//common:ostream",
  54. "//common:raw_string_ostream",
  55. "//toolchain/base:canonical_value_store",
  56. "@llvm-project//clang:ast",
  57. ],
  58. )
  59. cc_library(
  60. name = "file",
  61. srcs = [
  62. "builtin_function_kind.cpp",
  63. "class.cpp",
  64. "constant.cpp",
  65. "facet_type_info.cpp",
  66. "file.cpp",
  67. "function.cpp",
  68. "generic.cpp",
  69. "impl.cpp",
  70. "import_ir.cpp",
  71. "inst.cpp",
  72. "name.cpp",
  73. "name_scope.cpp",
  74. "pattern.cpp",
  75. "type.cpp",
  76. "type_info.cpp",
  77. "type_iterator.cpp",
  78. ],
  79. hdrs = [
  80. "associated_constant.h",
  81. "builtin_function_kind.h",
  82. "class.h",
  83. "constant.h",
  84. "copy_on_write_block.h",
  85. "cpp_global_var.h",
  86. "cpp_overload_set.h",
  87. "entity_name.h",
  88. "entity_with_params_base.h",
  89. "facet_type_info.h",
  90. "file.h",
  91. "function.h",
  92. "generic.h",
  93. "impl.h",
  94. "import_cpp.h",
  95. "import_ir.h",
  96. "inst.h",
  97. "interface.h",
  98. "name.h",
  99. "name_scope.h",
  100. "named_constraint.h",
  101. "pattern.h",
  102. "struct_type_field.h",
  103. "type.h",
  104. "type_info.h",
  105. "type_iterator.h",
  106. "vtable.h",
  107. ],
  108. textual_hdrs = [
  109. "builtin_function_kind.def",
  110. ],
  111. deps = [
  112. ":clang_decl",
  113. ":typed_insts",
  114. "//common:check",
  115. "//common:enum_base",
  116. "//common:enum_mask_base",
  117. "//common:error",
  118. "//common:hashing",
  119. "//common:map",
  120. "//common:ostream",
  121. "//common:raw_string_ostream",
  122. "//common:set",
  123. "//common:struct_reflection",
  124. "//toolchain/base:block_value_store",
  125. "//toolchain/base:canonical_value_store",
  126. "//toolchain/base:index_base",
  127. "//toolchain/base:int",
  128. "//toolchain/base:kind_switch",
  129. "//toolchain/base:relational_value_store",
  130. "//toolchain/base:shared_value_stores",
  131. "//toolchain/base:value_ids",
  132. "//toolchain/base:value_store",
  133. "//toolchain/base:yaml",
  134. "//toolchain/lex:token_kind",
  135. "//toolchain/parse:node_kind",
  136. "//toolchain/parse:tree",
  137. "@llvm-project//clang:ast",
  138. "@llvm-project//clang:frontend",
  139. "@llvm-project//clang:sema",
  140. "@llvm-project//llvm:Support",
  141. ],
  142. )
  143. cc_library(
  144. name = "stringify",
  145. srcs = ["stringify.cpp"],
  146. hdrs = ["stringify.h"],
  147. deps = [
  148. ":file",
  149. ":typed_insts",
  150. "//common:check",
  151. "//common:concepts",
  152. "//common:raw_string_ostream",
  153. "//toolchain/base:kind_switch",
  154. "@llvm-project//llvm:Support",
  155. ],
  156. )
  157. cc_library(
  158. name = "inst_namer",
  159. srcs = [
  160. "inst_fingerprinter.cpp",
  161. "inst_namer.cpp",
  162. ],
  163. hdrs = [
  164. "inst_fingerprinter.h",
  165. "inst_namer.h",
  166. ],
  167. deps = [
  168. ":file",
  169. ":typed_insts",
  170. "//common:concepts",
  171. "//common:ostream",
  172. "//common:raw_string_ostream",
  173. "//common:type_enum",
  174. "//toolchain/base:fixed_size_value_store",
  175. "//toolchain/base:kind_switch",
  176. "//toolchain/base:shared_value_stores",
  177. "//toolchain/base:value_ids",
  178. "//toolchain/lex:tokenized_buffer",
  179. "//toolchain/parse:tree",
  180. "@llvm-project//llvm:Support",
  181. ],
  182. )
  183. cc_library(
  184. name = "formatter",
  185. srcs = ["formatter.cpp"],
  186. hdrs = ["formatter.h"],
  187. deps = [
  188. ":expr_info",
  189. ":file",
  190. ":inst_namer",
  191. ":typed_insts",
  192. "//common:concepts",
  193. "//common:ostream",
  194. "//toolchain/base:fixed_size_value_store",
  195. "//toolchain/base:kind_switch",
  196. "//toolchain/base:shared_value_stores",
  197. "//toolchain/lex:tokenized_buffer",
  198. "//toolchain/parse:tree",
  199. "@llvm-project//llvm:Support",
  200. ],
  201. )
  202. cc_library(
  203. name = "entry_point",
  204. srcs = ["entry_point.cpp"],
  205. hdrs = ["entry_point.h"],
  206. deps = [
  207. ":file",
  208. "@llvm-project//llvm:Support",
  209. ],
  210. )
  211. cc_library(
  212. name = "absolute_node_id",
  213. srcs = ["absolute_node_id.cpp"],
  214. hdrs = ["absolute_node_id.h"],
  215. deps = [
  216. ":file",
  217. ":typed_insts",
  218. "//toolchain/parse:tree",
  219. "@llvm-project//llvm:Support",
  220. ],
  221. )
  222. cc_library(
  223. name = "expr_info",
  224. srcs = ["expr_info.cpp"],
  225. hdrs = ["expr_info.h"],
  226. deps = [
  227. ":file",
  228. ":typed_insts",
  229. "//common:check",
  230. "//toolchain/base:kind_switch",
  231. ],
  232. )
  233. cc_library(
  234. name = "diagnostic_loc_converter",
  235. srcs = ["diagnostic_loc_converter.cpp"],
  236. hdrs = ["diagnostic_loc_converter.h"],
  237. deps = [
  238. ":absolute_node_id",
  239. ":file",
  240. ":typed_insts",
  241. "//toolchain/diagnostics:diagnostic_emitter",
  242. "//toolchain/parse:tree",
  243. "@llvm-project//clang:frontend",
  244. "@llvm-project//llvm:Support",
  245. ],
  246. )
  247. cc_library(
  248. name = "dump",
  249. srcs = ["dump.cpp"],
  250. hdrs = ["dump.h"],
  251. deps = [
  252. ":file",
  253. ":stringify",
  254. ":typed_insts",
  255. "//common:ostream",
  256. "//common:raw_string_ostream",
  257. ],
  258. # Always link dump methods so they are callable from a debugger
  259. # even though they are never called.
  260. alwayslink = 1,
  261. )
  262. cc_test(
  263. name = "name_scope_test",
  264. size = "small",
  265. srcs = ["name_scope_test.cpp"],
  266. deps = [
  267. ":file",
  268. "//testing/base:gtest_main",
  269. "@googletest//:gtest",
  270. ],
  271. )
  272. cc_test(
  273. name = "typed_insts_test",
  274. size = "small",
  275. srcs = ["typed_insts_test.cpp"],
  276. deps = [
  277. ":file",
  278. ":typed_insts",
  279. "//testing/base:gtest_main",
  280. "@googletest//:gtest",
  281. ],
  282. )
  283. cc_test(
  284. name = "yaml_test",
  285. size = "small",
  286. srcs = ["yaml_test.cpp"],
  287. deps = [
  288. "//common:all_llvm_targets",
  289. "//common:ostream",
  290. "//common:raw_string_ostream",
  291. "//testing/base:global_exe_path",
  292. "//testing/base:gtest_main",
  293. "//toolchain/driver",
  294. "//toolchain/testing:yaml_test_helpers",
  295. "@googletest//:gtest",
  296. "@llvm-project//llvm:Support",
  297. ],
  298. )