BUILD 8.0 KB

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