BUILD 6.1 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. 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_types",
  117. "//common:check",
  118. "@llvm-project//llvm:Support",
  119. ],
  120. )
  121. cc_library(
  122. name = "timings",
  123. hdrs = ["timings.h"],
  124. deps = [
  125. ":yaml",
  126. "@llvm-project//llvm:Support",
  127. ],
  128. )
  129. cc_library(
  130. name = "value_ids",
  131. hdrs = ["value_ids.h"],
  132. deps = [
  133. ":index_base",
  134. "//common:check",
  135. "//common:ostream",
  136. "@llvm-project//llvm:Support",
  137. ],
  138. )
  139. cc_library(
  140. name = "value_store",
  141. hdrs = ["value_store.h"],
  142. deps = [
  143. ":mem_usage",
  144. ":value_store_types",
  145. ":yaml",
  146. "//common:check",
  147. "//common:hashtable_key_context",
  148. "//common:ostream",
  149. "//common:set",
  150. "@llvm-project//llvm:Support",
  151. ],
  152. )
  153. cc_test(
  154. name = "value_store_test",
  155. size = "small",
  156. srcs = ["value_store_test.cpp"],
  157. deps = [
  158. ":value_ids",
  159. ":value_store",
  160. "//common:raw_string_ostream",
  161. "//testing/base:gtest_main",
  162. "@googletest//:gtest",
  163. ],
  164. )
  165. cc_library(
  166. name = "value_store_types",
  167. hdrs = ["value_store_types.h"],
  168. deps = [
  169. "@llvm-project//llvm:Support",
  170. ],
  171. )
  172. cc_library(
  173. name = "int",
  174. srcs = ["int.cpp"],
  175. hdrs = ["int.h"],
  176. deps = [
  177. ":canonical_value_store",
  178. ":index_base",
  179. ":mem_usage",
  180. ":value_store",
  181. ":yaml",
  182. "//common:check",
  183. "//common:hashtable_key_context",
  184. "//common:ostream",
  185. "//common:set",
  186. "@llvm-project//llvm:Support",
  187. ],
  188. )
  189. cc_test(
  190. name = "int_test",
  191. size = "small",
  192. srcs = ["int_test.cpp"],
  193. deps = [
  194. ":int",
  195. "//common:raw_string_ostream",
  196. "//testing/base:gtest_main",
  197. "//toolchain/testing:yaml_test_helpers",
  198. "@googletest//:gtest",
  199. ],
  200. )
  201. generate_llvm_tools_def(
  202. name = "llvm_tools_def",
  203. out = "llvm_tools.def",
  204. )
  205. config_setting(
  206. name = "is_macos",
  207. constraint_values = ["@platforms//os:macos"],
  208. )
  209. cc_library(
  210. name = "llvm_tools",
  211. srcs = ["llvm_tools.cpp"],
  212. hdrs = ["llvm_tools.h"],
  213. linkopts = select({
  214. # TODO: This should be moved upstream to LLVM's tool libraries that
  215. # require it.
  216. ":is_macos": [
  217. "-framework",
  218. "CoreFoundation",
  219. ],
  220. "//conditions:default": [],
  221. }),
  222. deps = [
  223. ":llvm_tools_def",
  224. "//common:command_line",
  225. "//common:enum_base",
  226. "@llvm-project//llvm:Support",
  227. ] + [info.lib for info in LLVM_MAIN_TOOLS.values()],
  228. )
  229. generate_runtime_sources_cc_library(name = "runtime_sources")
  230. cc_library(
  231. name = "shared_value_stores",
  232. hdrs = ["shared_value_stores.h"],
  233. deps = [
  234. ":canonical_value_store",
  235. ":int",
  236. ":mem_usage",
  237. ":value_ids",
  238. ":value_store",
  239. ":yaml",
  240. "@llvm-project//llvm:Support",
  241. ],
  242. )
  243. cc_test(
  244. name = "shared_value_stores_test",
  245. size = "small",
  246. srcs = ["shared_value_stores_test.cpp"],
  247. deps = [
  248. ":shared_value_stores",
  249. "//common:raw_string_ostream",
  250. "//testing/base:gtest_main",
  251. "//toolchain/testing:yaml_test_helpers",
  252. "@googletest//:gtest",
  253. ],
  254. )
  255. cc_library(
  256. name = "yaml",
  257. hdrs = ["yaml.h"],
  258. deps = [
  259. "//common:check",
  260. "//common:ostream",
  261. "@llvm-project//llvm:Support",
  262. ],
  263. )