BUILD 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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/fuzzing:rules.bzl", "cc_fuzz_test")
  5. package(default_visibility = ["//visibility:public"])
  6. cc_library(
  7. name = "token_kind",
  8. srcs = ["token_kind.cpp"],
  9. hdrs = ["token_kind.h"],
  10. textual_hdrs = ["token_registry.def"],
  11. deps = [
  12. "//common:check",
  13. "//common:ostream",
  14. "@llvm-project//llvm:Support",
  15. ],
  16. )
  17. cc_test(
  18. name = "token_kind_test",
  19. size = "small",
  20. srcs = ["token_kind_test.cpp"],
  21. deps = [
  22. ":token_kind",
  23. "//common:gtest_main",
  24. "@com_google_googletest//:gtest",
  25. "@llvm-project//llvm:Support",
  26. ],
  27. )
  28. cc_library(
  29. name = "character_set",
  30. hdrs = ["character_set.h"],
  31. deps = ["@llvm-project//llvm:Support"],
  32. )
  33. cc_library(
  34. name = "lex_helpers",
  35. srcs = ["lex_helpers.cpp"],
  36. hdrs = ["lex_helpers.h"],
  37. deps = [
  38. "//toolchain/diagnostics:diagnostic_emitter",
  39. "@llvm-project//llvm:Support",
  40. ],
  41. )
  42. cc_library(
  43. name = "test_helpers",
  44. testonly = 1,
  45. hdrs = ["test_helpers.h"],
  46. deps = [
  47. "//common:check",
  48. "//common:string_helpers",
  49. "//toolchain/diagnostics:diagnostic_emitter",
  50. "@com_google_googletest//:gtest",
  51. "@llvm-project//llvm:Support",
  52. ],
  53. )
  54. cc_library(
  55. name = "numeric_literal",
  56. srcs = ["numeric_literal.cpp"],
  57. hdrs = ["numeric_literal.h"],
  58. deps = [
  59. ":character_set",
  60. ":lex_helpers",
  61. "//common:check",
  62. "//toolchain/diagnostics:diagnostic_emitter",
  63. "@llvm-project//llvm:Support",
  64. ],
  65. )
  66. cc_binary(
  67. name = "numeric_literal_benchmark",
  68. testonly = 1,
  69. srcs = ["numeric_literal_benchmark.cpp"],
  70. deps = [
  71. ":numeric_literal",
  72. "//common:check",
  73. "//toolchain/diagnostics:null_diagnostics",
  74. "@com_github_google_benchmark//:benchmark_main",
  75. ],
  76. )
  77. cc_test(
  78. name = "numeric_literal_test",
  79. size = "small",
  80. srcs = ["numeric_literal_test.cpp"],
  81. deps = [
  82. ":numeric_literal",
  83. ":test_helpers",
  84. "//common:check",
  85. "//common:gtest_main",
  86. "//common:ostream",
  87. "//toolchain/diagnostics:diagnostic_emitter",
  88. "@com_google_googletest//:gtest",
  89. "@llvm-project//llvm:Support",
  90. ],
  91. )
  92. cc_fuzz_test(
  93. name = "numeric_literal_fuzzer",
  94. size = "small",
  95. srcs = ["numeric_literal_fuzzer.cpp"],
  96. corpus = glob(["fuzzer_corpus/numeric_literal/*"]),
  97. deps = [
  98. ":numeric_literal",
  99. "//toolchain/diagnostics:diagnostic_emitter",
  100. "//toolchain/diagnostics:null_diagnostics",
  101. "@llvm-project//llvm:Support",
  102. ],
  103. )
  104. cc_library(
  105. name = "string_literal",
  106. srcs = ["string_literal.cpp"],
  107. hdrs = ["string_literal.h"],
  108. deps = [
  109. ":character_set",
  110. ":lex_helpers",
  111. "//common:check",
  112. "//toolchain/diagnostics:diagnostic_emitter",
  113. "@llvm-project//llvm:Support",
  114. ],
  115. )
  116. cc_binary(
  117. name = "string_literal_benchmark",
  118. testonly = 1,
  119. srcs = ["string_literal_benchmark.cpp"],
  120. deps = [
  121. ":string_literal",
  122. "@com_github_google_benchmark//:benchmark_main",
  123. ],
  124. )
  125. cc_test(
  126. name = "string_literal_test",
  127. size = "small",
  128. srcs = ["string_literal_test.cpp"],
  129. deps = [
  130. ":string_literal",
  131. ":test_helpers",
  132. "//common:check",
  133. "//common:gtest_main",
  134. "//common:ostream",
  135. "//toolchain/diagnostics:diagnostic_emitter",
  136. "@com_google_googletest//:gtest",
  137. "@llvm-project//llvm:Support",
  138. ],
  139. )
  140. cc_fuzz_test(
  141. name = "string_literal_fuzzer",
  142. size = "small",
  143. srcs = ["string_literal_fuzzer.cpp"],
  144. corpus = glob(["fuzzer_corpus/string_literal/*"]),
  145. deps = [
  146. ":string_literal",
  147. "//common:check",
  148. "//toolchain/diagnostics:diagnostic_emitter",
  149. "//toolchain/diagnostics:null_diagnostics",
  150. "@llvm-project//llvm:Support",
  151. ],
  152. )
  153. cc_library(
  154. name = "tokenized_buffer",
  155. srcs = ["tokenized_buffer.cpp"],
  156. hdrs = ["tokenized_buffer.h"],
  157. deps = [
  158. ":character_set",
  159. ":lex_helpers",
  160. ":numeric_literal",
  161. ":string_literal",
  162. ":token_kind",
  163. "//common:check",
  164. "//common:ostream",
  165. "//common:string_helpers",
  166. "//toolchain/diagnostics:diagnostic_emitter",
  167. "//toolchain/source:source_buffer",
  168. "@llvm-project//llvm:Support",
  169. ],
  170. )
  171. cc_library(
  172. name = "tokenized_buffer_test_helpers",
  173. testonly = 1,
  174. hdrs = ["tokenized_buffer_test_helpers.h"],
  175. deps = [
  176. ":tokenized_buffer",
  177. "//common:check",
  178. "@com_google_googletest//:gtest",
  179. "@llvm-project//llvm:Support",
  180. ],
  181. )
  182. cc_test(
  183. name = "tokenized_buffer_test",
  184. size = "small",
  185. srcs = ["tokenized_buffer_test.cpp"],
  186. deps = [
  187. ":tokenized_buffer",
  188. ":tokenized_buffer_test_helpers",
  189. "//common:gtest_main",
  190. "//toolchain/common:yaml_test_helpers",
  191. "//toolchain/diagnostics:diagnostic_emitter",
  192. "//toolchain/diagnostics:mocks",
  193. "@com_google_googletest//:gtest",
  194. "@llvm-project//llvm:Support",
  195. ],
  196. )
  197. cc_fuzz_test(
  198. name = "tokenized_buffer_fuzzer",
  199. size = "small",
  200. srcs = ["tokenized_buffer_fuzzer.cpp"],
  201. corpus = glob(["fuzzer_corpus/tokenized_buffer/*"]),
  202. deps = [
  203. ":tokenized_buffer",
  204. "//common:check",
  205. "//toolchain/diagnostics:diagnostic_emitter",
  206. "//toolchain/diagnostics:null_diagnostics",
  207. "@llvm-project//llvm:Support",
  208. ],
  209. )