BUILD 7.2 KB

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