BUILD 7.4 KB

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