BUILD 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. load("llvm_tools.bzl", "LLVM_MAIN_TOOLS", "generate_llvm_tools_def")
  6. load("runtime_sources.bzl", "generate_runtime_sources_cc_library")
  7. package(default_visibility = ["//visibility:public"])
  8. cc_library(
  9. name = "block_value_store",
  10. hdrs = ["block_value_store.h"],
  11. deps = [
  12. ":mem_usage",
  13. ":value_store",
  14. ":yaml",
  15. "//common:check",
  16. "//common:hashing",
  17. "//common:set",
  18. "@llvm-project//llvm:Support",
  19. ],
  20. )
  21. cc_library(
  22. name = "canonical_value_store",
  23. hdrs = ["canonical_value_store.h"],
  24. deps = [
  25. ":mem_usage",
  26. ":value_store",
  27. ":value_store_types",
  28. ":yaml",
  29. "//common:hashtable_key_context",
  30. "//common:set",
  31. ],
  32. )
  33. cc_test(
  34. name = "canonical_value_store_test",
  35. size = "small",
  36. srcs = ["canonical_value_store_test.cpp"],
  37. deps = [
  38. ":canonical_value_store",
  39. ":value_ids",
  40. "//testing/base:gtest_main",
  41. "@googletest//:gtest",
  42. "@llvm-project//llvm:Support",
  43. ],
  44. )
  45. cc_library(
  46. name = "clang_invocation",
  47. srcs = ["clang_invocation.cpp"],
  48. hdrs = ["clang_invocation.h"],
  49. deps = [
  50. "//common:check",
  51. "//toolchain/diagnostics:diagnostic_emitter",
  52. "@llvm-project//clang:basic",
  53. "@llvm-project//clang:frontend",
  54. "@llvm-project//llvm:Support",
  55. ],
  56. )
  57. cc_library(
  58. name = "fixed_size_value_store",
  59. hdrs = ["fixed_size_value_store.h"],
  60. deps = [
  61. ":mem_usage",
  62. ":value_store",
  63. ":value_store_types",
  64. "//common:check",
  65. "@llvm-project//llvm:Support",
  66. ],
  67. )
  68. cc_library(
  69. name = "for_each_macro",
  70. hdrs = ["for_each_macro.h"],
  71. deps = [
  72. "@llvm-project//llvm:Support",
  73. ],
  74. )
  75. cc_library(
  76. name = "index_base",
  77. hdrs = ["index_base.h"],
  78. deps = [
  79. "//common:ostream",
  80. "@llvm-project//llvm:Support",
  81. ],
  82. )
  83. cc_library(
  84. name = "kind_switch",
  85. hdrs = ["kind_switch.h"],
  86. deps = [
  87. ":for_each_macro",
  88. "@llvm-project//llvm:Support",
  89. ],
  90. )
  91. cc_test(
  92. name = "kind_switch_test",
  93. size = "small",
  94. srcs = ["kind_switch_test.cpp"],
  95. deps = [
  96. ":kind_switch",
  97. "//common:raw_string_ostream",
  98. "//testing/base:gtest_main",
  99. "@googletest//:gtest",
  100. ],
  101. )
  102. cc_library(
  103. name = "mem_usage",
  104. hdrs = ["mem_usage.h"],
  105. deps = [
  106. ":yaml",
  107. "//common:map",
  108. "//common:set",
  109. "@llvm-project//llvm:Support",
  110. ],
  111. )
  112. cc_library(
  113. name = "relational_value_store",
  114. hdrs = ["relational_value_store.h"],
  115. deps = [
  116. ":value_store",
  117. ":value_store_types",
  118. "//common:check",
  119. "@llvm-project//llvm:Support",
  120. ],
  121. )
  122. cc_library(
  123. name = "timings",
  124. hdrs = ["timings.h"],
  125. deps = [
  126. ":yaml",
  127. "@llvm-project//llvm:Support",
  128. ],
  129. )
  130. cc_library(
  131. name = "value_ids",
  132. hdrs = ["value_ids.h"],
  133. deps = [
  134. ":index_base",
  135. "//common:check",
  136. "//common:ostream",
  137. "@llvm-project//llvm:Support",
  138. ],
  139. )
  140. cc_library(
  141. name = "value_store",
  142. hdrs = ["value_store.h"],
  143. deps = [
  144. ":mem_usage",
  145. ":value_store_types",
  146. ":yaml",
  147. "//common:check",
  148. "//common:hashtable_key_context",
  149. "//common:ostream",
  150. "//common:set",
  151. "@llvm-project//llvm:Support",
  152. ],
  153. )
  154. cc_test(
  155. name = "value_store_test",
  156. size = "small",
  157. srcs = ["value_store_test.cpp"],
  158. deps = [
  159. ":value_ids",
  160. ":value_store",
  161. "//common:raw_string_ostream",
  162. "//testing/base:gtest_main",
  163. "@googletest//:gtest",
  164. ],
  165. )
  166. cc_library(
  167. name = "value_store_types",
  168. hdrs = ["value_store_types.h"],
  169. deps = [
  170. "@llvm-project//llvm:Support",
  171. ],
  172. )
  173. cc_library(
  174. name = "int",
  175. srcs = ["int.cpp"],
  176. hdrs = ["int.h"],
  177. deps = [
  178. ":canonical_value_store",
  179. ":index_base",
  180. ":mem_usage",
  181. ":value_store",
  182. ":yaml",
  183. "//common:check",
  184. "//common:hashtable_key_context",
  185. "//common:ostream",
  186. "//common:set",
  187. "@llvm-project//llvm:Support",
  188. ],
  189. )
  190. cc_test(
  191. name = "int_test",
  192. size = "small",
  193. srcs = ["int_test.cpp"],
  194. deps = [
  195. ":int",
  196. "//common:raw_string_ostream",
  197. "//testing/base:gtest_main",
  198. "//toolchain/testing:yaml_test_helpers",
  199. "@googletest//:gtest",
  200. ],
  201. )
  202. generate_llvm_tools_def(
  203. name = "llvm_tools_def",
  204. out = "llvm_tools.def",
  205. )
  206. config_setting(
  207. name = "is_macos",
  208. constraint_values = ["@platforms//os:macos"],
  209. )
  210. cc_library(
  211. name = "llvm_tools",
  212. srcs = ["llvm_tools.cpp"],
  213. hdrs = ["llvm_tools.h"],
  214. linkopts = select({
  215. # TODO: This should be moved upstream to LLVM's tool libraries that
  216. # require it.
  217. ":is_macos": [
  218. "-framework",
  219. "CoreFoundation",
  220. ],
  221. "//conditions:default": [],
  222. }),
  223. deps = [
  224. ":llvm_tools_def",
  225. "//common:command_line",
  226. "//common:enum_base",
  227. "@llvm-project//llvm:Support",
  228. ] + [info.lib for info in LLVM_MAIN_TOOLS.values()],
  229. )
  230. generate_runtime_sources_cc_library(name = "runtime_sources")
  231. cc_library(
  232. name = "shared_value_stores",
  233. hdrs = ["shared_value_stores.h"],
  234. deps = [
  235. ":canonical_value_store",
  236. ":int",
  237. ":mem_usage",
  238. ":value_ids",
  239. ":value_store",
  240. ":yaml",
  241. "@llvm-project//llvm:Support",
  242. ],
  243. )
  244. cc_test(
  245. name = "shared_value_stores_test",
  246. size = "small",
  247. srcs = ["shared_value_stores_test.cpp"],
  248. deps = [
  249. ":shared_value_stores",
  250. "//common:raw_string_ostream",
  251. "//testing/base:gtest_main",
  252. "//toolchain/testing:yaml_test_helpers",
  253. "@googletest//:gtest",
  254. ],
  255. )
  256. cc_library(
  257. name = "yaml",
  258. hdrs = ["yaml.h"],
  259. deps = [
  260. "//common:check",
  261. "//common:ostream",
  262. "@llvm-project//llvm:Support",
  263. ],
  264. )