BUILD 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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_kind.def"],
  11. deps = [
  12. "//common:check",
  13. "//common:enum_base",
  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. "//toolchain/diagnostics:null_diagnostics",
  123. "@com_github_google_benchmark//:benchmark_main",
  124. ],
  125. )
  126. cc_test(
  127. name = "string_literal_test",
  128. size = "small",
  129. srcs = ["string_literal_test.cpp"],
  130. deps = [
  131. ":string_literal",
  132. ":test_helpers",
  133. "//common:check",
  134. "//common:gtest_main",
  135. "//common:ostream",
  136. "//toolchain/diagnostics:diagnostic_emitter",
  137. "@com_google_googletest//:gtest",
  138. "@llvm-project//llvm:Support",
  139. ],
  140. )
  141. cc_fuzz_test(
  142. name = "string_literal_fuzzer",
  143. size = "small",
  144. srcs = ["string_literal_fuzzer.cpp"],
  145. corpus = glob(["fuzzer_corpus/string_literal/*"]),
  146. deps = [
  147. ":string_literal",
  148. "//common:check",
  149. "//toolchain/diagnostics:diagnostic_emitter",
  150. "//toolchain/diagnostics:null_diagnostics",
  151. "@llvm-project//llvm:Support",
  152. ],
  153. )
  154. cc_library(
  155. name = "tokenized_buffer",
  156. srcs = ["tokenized_buffer.cpp"],
  157. hdrs = ["tokenized_buffer.h"],
  158. deps = [
  159. ":character_set",
  160. ":lex_helpers",
  161. ":numeric_literal",
  162. ":string_literal",
  163. ":token_kind",
  164. "//common:check",
  165. "//common:ostream",
  166. "//common:string_helpers",
  167. "//toolchain/common:index_base",
  168. "//toolchain/diagnostics:diagnostic_emitter",
  169. "//toolchain/source:source_buffer",
  170. "@llvm-project//llvm:Support",
  171. ],
  172. )
  173. cc_library(
  174. name = "tokenized_buffer_test_helpers",
  175. testonly = 1,
  176. hdrs = ["tokenized_buffer_test_helpers.h"],
  177. deps = [
  178. ":tokenized_buffer",
  179. "//common:check",
  180. "@com_google_googletest//:gtest",
  181. "@llvm-project//llvm:Support",
  182. ],
  183. )
  184. cc_test(
  185. name = "tokenized_buffer_test",
  186. size = "small",
  187. srcs = ["tokenized_buffer_test.cpp"],
  188. deps = [
  189. ":tokenized_buffer",
  190. ":tokenized_buffer_test_helpers",
  191. "//common:gtest_main",
  192. "//toolchain/common:yaml_test_helpers",
  193. "//toolchain/diagnostics:diagnostic_emitter",
  194. "//toolchain/diagnostics:mocks",
  195. "@com_google_googletest//:gtest",
  196. "@llvm-project//llvm:Support",
  197. ],
  198. )
  199. cc_fuzz_test(
  200. name = "tokenized_buffer_fuzzer",
  201. size = "small",
  202. srcs = ["tokenized_buffer_fuzzer.cpp"],
  203. corpus = glob(["fuzzer_corpus/tokenized_buffer/*"]),
  204. deps = [
  205. ":tokenized_buffer",
  206. "//common:check",
  207. "//toolchain/diagnostics:diagnostic_emitter",
  208. "//toolchain/diagnostics:null_diagnostics",
  209. "@llvm-project//llvm:Support",
  210. ],
  211. )