BUILD 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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("@rules_cc//cc: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_library(
  44. name = "inst",
  45. srcs = ["inst.cpp"],
  46. hdrs = ["inst.h"],
  47. deps = [
  48. ":block_value_store",
  49. ":typed_insts",
  50. "//common:check",
  51. "//common:hashing",
  52. "//common:ostream",
  53. "//common:raw_string_ostream",
  54. "//common:struct_reflection",
  55. "//toolchain/base:index_base",
  56. "//toolchain/base:int",
  57. "//toolchain/base:value_store",
  58. "@llvm-project//llvm:Support",
  59. ],
  60. )
  61. cc_library(
  62. name = "file",
  63. srcs = [
  64. "builtin_function_kind.cpp",
  65. "class.cpp",
  66. "constant.cpp",
  67. "facet_type_info.cpp",
  68. "file.cpp",
  69. "function.cpp",
  70. "generic.cpp",
  71. "impl.cpp",
  72. "name.cpp",
  73. "name_scope.cpp",
  74. "type.cpp",
  75. "type_info.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_ir.h",
  91. "interface.h",
  92. "name.h",
  93. "name_scope.h",
  94. "struct_type_field.h",
  95. "type.h",
  96. "type_info.h",
  97. ],
  98. textual_hdrs = [
  99. "builtin_function_kind.def",
  100. ],
  101. deps = [
  102. ":block_value_store",
  103. ":inst",
  104. ":typed_insts",
  105. "//common:check",
  106. "//common:enum_base",
  107. "//common:error",
  108. "//common:hashing",
  109. "//common:map",
  110. "//common:ostream",
  111. "//common:raw_string_ostream",
  112. "//common:set",
  113. "//toolchain/base:int",
  114. "//toolchain/base:kind_switch",
  115. "//toolchain/base:shared_value_stores",
  116. "//toolchain/base:value_ids",
  117. "//toolchain/base:value_store",
  118. "//toolchain/base:yaml",
  119. "//toolchain/lex:token_kind",
  120. "//toolchain/parse:node_kind",
  121. "//toolchain/parse:tree",
  122. "@llvm-project//llvm:Support",
  123. ],
  124. )
  125. cc_library(
  126. name = "stringify_type",
  127. srcs = ["stringify_type.cpp"],
  128. hdrs = ["stringify_type.h"],
  129. deps = [
  130. ":file",
  131. ":typed_insts",
  132. "//common:check",
  133. "//common:raw_string_ostream",
  134. "//toolchain/base:kind_switch",
  135. "@llvm-project//llvm:Support",
  136. ],
  137. )
  138. cc_library(
  139. name = "inst_namer",
  140. srcs = [
  141. "inst_fingerprinter.cpp",
  142. "inst_namer.cpp",
  143. ],
  144. hdrs = [
  145. "inst_fingerprinter.h",
  146. "inst_namer.h",
  147. ],
  148. deps = [
  149. ":file",
  150. ":typed_insts",
  151. "//common:ostream",
  152. "//common:raw_string_ostream",
  153. "//toolchain/base:kind_switch",
  154. "//toolchain/base:shared_value_stores",
  155. "//toolchain/base:value_ids",
  156. "//toolchain/lex:tokenized_buffer",
  157. "//toolchain/parse:tree",
  158. "@llvm-project//llvm:Support",
  159. ],
  160. )
  161. cc_library(
  162. name = "formatter",
  163. srcs = ["formatter.cpp"],
  164. hdrs = ["formatter.h"],
  165. deps = [
  166. ":file",
  167. ":inst_namer",
  168. ":typed_insts",
  169. "//common:ostream",
  170. "//toolchain/base:kind_switch",
  171. "//toolchain/base:shared_value_stores",
  172. "//toolchain/lex:tokenized_buffer",
  173. "//toolchain/parse:tree",
  174. "@llvm-project//llvm:Support",
  175. ],
  176. )
  177. cc_library(
  178. name = "entry_point",
  179. srcs = ["entry_point.cpp"],
  180. hdrs = ["entry_point.h"],
  181. deps = [
  182. ":file",
  183. "@llvm-project//llvm:Support",
  184. ],
  185. )
  186. cc_library(
  187. name = "absolute_node_id",
  188. srcs = ["absolute_node_id.cpp"],
  189. hdrs = ["absolute_node_id.h"],
  190. deps = [
  191. ":file",
  192. ":typed_insts",
  193. "//toolchain/parse:tree",
  194. "@llvm-project//llvm:Support",
  195. ],
  196. )
  197. cc_library(
  198. name = "dump",
  199. srcs = ["dump.cpp"],
  200. hdrs = ["dump.h"],
  201. deps = [
  202. ":file",
  203. ":stringify_type",
  204. "//common:ostream",
  205. ],
  206. # Always link dump methods so they are callable from a debugger
  207. # even though they are never called.
  208. alwayslink = 1,
  209. )
  210. cc_test(
  211. name = "name_scope_test",
  212. size = "small",
  213. srcs = ["name_scope_test.cpp"],
  214. deps = [
  215. ":file",
  216. "//testing/base:gtest_main",
  217. "@googletest//:gtest",
  218. ],
  219. )
  220. cc_test(
  221. name = "typed_insts_test",
  222. size = "small",
  223. srcs = ["typed_insts_test.cpp"],
  224. deps = [
  225. ":inst",
  226. ":typed_insts",
  227. "//testing/base:gtest_main",
  228. "@googletest//:gtest",
  229. ],
  230. )
  231. cc_test(
  232. name = "yaml_test",
  233. size = "small",
  234. srcs = ["yaml_test.cpp"],
  235. deps = [
  236. "//common:ostream",
  237. "//common:raw_string_ostream",
  238. "//testing/base:global_exe_path",
  239. "//testing/base:gtest_main",
  240. "//toolchain/driver",
  241. "//toolchain/testing:yaml_test_helpers",
  242. "@googletest//:gtest",
  243. "@llvm-project//llvm:Support",
  244. ],
  245. )