BUILD 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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 = "block_value_store",
  8. hdrs = ["block_value_store.h"],
  9. deps = [
  10. "//common:hashing",
  11. "//common:set",
  12. "//toolchain/base:value_store",
  13. "//toolchain/base:yaml",
  14. "@llvm-project//llvm:Support",
  15. ],
  16. )
  17. cc_library(
  18. name = "typed_insts",
  19. srcs = [
  20. "ids.cpp",
  21. "inst_kind.cpp",
  22. ],
  23. hdrs = [
  24. "id_kind.h",
  25. "ids.h",
  26. "inst_kind.h",
  27. "singleton_insts.h",
  28. "typed_insts.h",
  29. ],
  30. textual_hdrs = ["inst_kind.def"],
  31. deps = [
  32. "//common:check",
  33. "//common:enum_base",
  34. "//common:ostream",
  35. "//toolchain/base:index_base",
  36. "//toolchain/base:int",
  37. "//toolchain/base:value_ids",
  38. "//toolchain/diagnostics:diagnostic_emitter",
  39. "//toolchain/parse:node_kind",
  40. "@llvm-project//llvm:Support",
  41. ],
  42. )
  43. cc_test(
  44. name = "ids_test",
  45. srcs = ["ids_test.cpp"],
  46. deps = [
  47. ":typed_insts",
  48. "//testing/base:gtest_main",
  49. "@googletest//:gtest",
  50. ],
  51. )
  52. cc_library(
  53. name = "inst",
  54. srcs = ["inst.cpp"],
  55. hdrs = ["inst.h"],
  56. deps = [
  57. ":block_value_store",
  58. ":typed_insts",
  59. "//common:check",
  60. "//common:hashing",
  61. "//common:ostream",
  62. "//common:raw_string_ostream",
  63. "//common:struct_reflection",
  64. "//toolchain/base:index_base",
  65. "//toolchain/base:int",
  66. "//toolchain/base:value_store",
  67. "@llvm-project//llvm:Support",
  68. ],
  69. )
  70. cc_library(
  71. name = "file",
  72. srcs = [
  73. "builtin_function_kind.cpp",
  74. "class.cpp",
  75. "constant.cpp",
  76. "facet_type_info.cpp",
  77. "file.cpp",
  78. "function.cpp",
  79. "generic.cpp",
  80. "impl.cpp",
  81. "name.cpp",
  82. "name_scope.cpp",
  83. "pattern.cpp",
  84. "type.cpp",
  85. "type_info.cpp",
  86. ],
  87. hdrs = [
  88. "associated_constant.h",
  89. "builtin_function_kind.h",
  90. "class.h",
  91. "constant.h",
  92. "copy_on_write_block.h",
  93. "entity_name.h",
  94. "entity_with_params_base.h",
  95. "facet_type_info.h",
  96. "file.h",
  97. "function.h",
  98. "generic.h",
  99. "impl.h",
  100. "import_cpp.h",
  101. "import_ir.h",
  102. "interface.h",
  103. "name.h",
  104. "name_scope.h",
  105. "pattern.h",
  106. "struct_type_field.h",
  107. "type.h",
  108. "type_info.h",
  109. ],
  110. textual_hdrs = [
  111. "builtin_function_kind.def",
  112. ],
  113. deps = [
  114. ":block_value_store",
  115. ":inst",
  116. ":typed_insts",
  117. "//common:check",
  118. "//common:enum_base",
  119. "//common:error",
  120. "//common:hashing",
  121. "//common:map",
  122. "//common:ostream",
  123. "//common:raw_string_ostream",
  124. "//common:set",
  125. "//toolchain/base:int",
  126. "//toolchain/base:kind_switch",
  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:raw_string_ostream",
  148. "//common:variant_helpers",
  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:ostream",
  167. "//common:raw_string_ostream",
  168. "//toolchain/base:kind_switch",
  169. "//toolchain/base:shared_value_stores",
  170. "//toolchain/base:value_ids",
  171. "//toolchain/lex:tokenized_buffer",
  172. "//toolchain/parse:tree",
  173. "@llvm-project//llvm:Support",
  174. ],
  175. )
  176. cc_library(
  177. name = "formatter",
  178. srcs = ["formatter.cpp"],
  179. hdrs = ["formatter.h"],
  180. deps = [
  181. ":expr_info",
  182. ":file",
  183. ":inst_namer",
  184. ":typed_insts",
  185. "//common:ostream",
  186. "//toolchain/base:kind_switch",
  187. "//toolchain/base:shared_value_stores",
  188. "//toolchain/lex:tokenized_buffer",
  189. "//toolchain/parse:tree",
  190. "@llvm-project//llvm:Support",
  191. ],
  192. )
  193. cc_library(
  194. name = "entry_point",
  195. srcs = ["entry_point.cpp"],
  196. hdrs = ["entry_point.h"],
  197. deps = [
  198. ":file",
  199. "@llvm-project//llvm:Support",
  200. ],
  201. )
  202. cc_library(
  203. name = "absolute_node_id",
  204. srcs = ["absolute_node_id.cpp"],
  205. hdrs = ["absolute_node_id.h"],
  206. deps = [
  207. ":file",
  208. ":typed_insts",
  209. "//toolchain/parse:tree",
  210. "@llvm-project//llvm:Support",
  211. ],
  212. )
  213. cc_library(
  214. name = "expr_info",
  215. srcs = ["expr_info.cpp"],
  216. hdrs = ["expr_info.h"],
  217. deps = [
  218. ":file",
  219. ":typed_insts",
  220. "//common:check",
  221. "//toolchain/base:kind_switch",
  222. ],
  223. )
  224. cc_library(
  225. name = "dump",
  226. srcs = ["dump.cpp"],
  227. hdrs = ["dump.h"],
  228. deps = [
  229. ":file",
  230. ":stringify",
  231. "//common:ostream",
  232. "//common:raw_string_ostream",
  233. ],
  234. # Always link dump methods so they are callable from a debugger
  235. # even though they are never called.
  236. alwayslink = 1,
  237. )
  238. cc_test(
  239. name = "name_scope_test",
  240. size = "small",
  241. srcs = ["name_scope_test.cpp"],
  242. deps = [
  243. ":file",
  244. "//testing/base:gtest_main",
  245. "@googletest//:gtest",
  246. ],
  247. )
  248. cc_test(
  249. name = "typed_insts_test",
  250. size = "small",
  251. srcs = ["typed_insts_test.cpp"],
  252. deps = [
  253. ":inst",
  254. ":typed_insts",
  255. "//testing/base:gtest_main",
  256. "@googletest//:gtest",
  257. ],
  258. )
  259. cc_test(
  260. name = "yaml_test",
  261. size = "small",
  262. srcs = ["yaml_test.cpp"],
  263. deps = [
  264. "//common:ostream",
  265. "//common:raw_string_ostream",
  266. "//testing/base:global_exe_path",
  267. "//testing/base:gtest_main",
  268. "//toolchain/driver",
  269. "//toolchain/testing:yaml_test_helpers",
  270. "@googletest//:gtest",
  271. "@llvm-project//llvm:Support",
  272. ],
  273. )