BUILD 5.5 KB

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