BUILD 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. package(default_visibility = ["//visibility:public"])
  7. cc_library(
  8. name = "index_base",
  9. hdrs = ["index_base.h"],
  10. deps = [
  11. "//common:ostream",
  12. "@llvm-project//llvm:Support",
  13. ],
  14. )
  15. cc_library(
  16. name = "kind_switch",
  17. hdrs = ["kind_switch.h"],
  18. deps = [
  19. "@llvm-project//llvm:Support",
  20. ],
  21. )
  22. cc_library(
  23. name = "pretty_stack_trace_function",
  24. hdrs = ["pretty_stack_trace_function.h"],
  25. deps = [
  26. "@llvm-project//llvm:Support",
  27. ],
  28. )
  29. cc_library(
  30. name = "mem_usage",
  31. hdrs = ["mem_usage.h"],
  32. deps = [
  33. ":yaml",
  34. "//common:map",
  35. "//common:set",
  36. "@llvm-project//llvm:Support",
  37. ],
  38. )
  39. cc_library(
  40. name = "timings",
  41. hdrs = ["timings.h"],
  42. deps = [
  43. ":yaml",
  44. "@llvm-project//llvm:Support",
  45. ],
  46. )
  47. cc_library(
  48. name = "value_ids",
  49. hdrs = ["value_ids.h"],
  50. deps = [
  51. ":index_base",
  52. "//common:check",
  53. "//common:ostream",
  54. "@llvm-project//llvm:Support",
  55. ],
  56. )
  57. cc_library(
  58. name = "value_store",
  59. hdrs = ["value_store.h"],
  60. deps = [
  61. ":mem_usage",
  62. ":yaml",
  63. "//common:check",
  64. "//common:hashtable_key_context",
  65. "//common:ostream",
  66. "//common:set",
  67. "@llvm-project//llvm:Support",
  68. ],
  69. )
  70. cc_test(
  71. name = "value_store_test",
  72. size = "small",
  73. srcs = ["value_store_test.cpp"],
  74. deps = [
  75. ":value_ids",
  76. ":value_store",
  77. "//common:raw_string_ostream",
  78. "//testing/base:gtest_main",
  79. "//toolchain/testing:yaml_test_helpers",
  80. "@googletest//:gtest",
  81. ],
  82. )
  83. cc_library(
  84. name = "int",
  85. srcs = ["int.cpp"],
  86. hdrs = ["int.h"],
  87. deps = [
  88. ":index_base",
  89. ":mem_usage",
  90. ":value_store",
  91. ":yaml",
  92. "//common:check",
  93. "//common:hashtable_key_context",
  94. "//common:ostream",
  95. "//common:set",
  96. "@llvm-project//llvm:Support",
  97. ],
  98. )
  99. cc_test(
  100. name = "int_test",
  101. size = "small",
  102. srcs = ["int_test.cpp"],
  103. deps = [
  104. ":int",
  105. "//common:raw_string_ostream",
  106. "//testing/base:gtest_main",
  107. "//toolchain/testing:yaml_test_helpers",
  108. "@googletest//:gtest",
  109. ],
  110. )
  111. generate_llvm_tools_def(
  112. name = "llvm_tools_def",
  113. out = "llvm_tools.def",
  114. )
  115. config_setting(
  116. name = "is_macos",
  117. constraint_values = ["@platforms//os:macos"],
  118. )
  119. cc_library(
  120. name = "llvm_tools",
  121. srcs = ["llvm_tools.cpp"],
  122. hdrs = ["llvm_tools.h"],
  123. linkopts = select({
  124. # TODO: This should be moved upstream to LLVM's tool libraries that
  125. # require it.
  126. ":is_macos": [
  127. "-framework",
  128. "CoreFoundation",
  129. ],
  130. "//conditions:default": [],
  131. }),
  132. deps = [
  133. ":llvm_tools_def",
  134. "//common:command_line",
  135. "//common:enum_base",
  136. "@llvm-project//llvm:Support",
  137. ] + [info.lib for info in LLVM_MAIN_TOOLS.values()],
  138. )
  139. cc_library(
  140. name = "shared_value_stores",
  141. hdrs = ["shared_value_stores.h"],
  142. deps = [
  143. ":int",
  144. ":mem_usage",
  145. ":value_ids",
  146. ":value_store",
  147. ":yaml",
  148. ],
  149. )
  150. cc_test(
  151. name = "shared_value_stores_test",
  152. size = "small",
  153. srcs = ["shared_value_stores_test.cpp"],
  154. deps = [
  155. ":shared_value_stores",
  156. "//common:raw_string_ostream",
  157. "//testing/base:gtest_main",
  158. "//toolchain/testing:yaml_test_helpers",
  159. "@googletest//:gtest",
  160. ],
  161. )
  162. cc_library(
  163. name = "yaml",
  164. hdrs = ["yaml.h"],
  165. deps = [
  166. "//common:check",
  167. "//common:ostream",
  168. "@llvm-project//llvm:Support",
  169. ],
  170. )