BUILD 6.1 KB

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