BUILD 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 = "test_helpers",
  33. testonly = 1,
  34. hdrs = ["test_helpers.h"],
  35. deps = [
  36. "//common:check",
  37. "//toolchain/diagnostics:diagnostic_emitter",
  38. "@com_google_googletest//:gtest",
  39. "@llvm-project//llvm:Support",
  40. ],
  41. )
  42. cc_library(
  43. name = "numeric_literal",
  44. srcs = ["numeric_literal.cpp"],
  45. hdrs = ["numeric_literal.h"],
  46. deps = [
  47. ":character_set",
  48. "//common:check",
  49. "//toolchain/diagnostics:diagnostic_emitter",
  50. "@llvm-project//llvm:Support",
  51. ],
  52. )
  53. cc_test(
  54. name = "numeric_literal_test",
  55. size = "small",
  56. srcs = ["numeric_literal_test.cpp"],
  57. deps = [
  58. ":numeric_literal",
  59. ":test_helpers",
  60. "//common:ostream",
  61. "//toolchain/diagnostics:diagnostic_emitter",
  62. "@com_google_googletest//:gtest_main",
  63. "@llvm-project//llvm:Support",
  64. ],
  65. )
  66. cc_fuzz_test(
  67. name = "numeric_literal_fuzzer",
  68. size = "small",
  69. srcs = ["numeric_literal_fuzzer.cpp"],
  70. corpus = glob(["fuzzer_corpus/numeric_literal/*"]),
  71. deps = [
  72. ":numeric_literal",
  73. "//toolchain/diagnostics:diagnostic_emitter",
  74. "//toolchain/diagnostics:null_diagnostics",
  75. "@llvm-project//llvm:Support",
  76. ],
  77. )
  78. cc_library(
  79. name = "string_literal",
  80. srcs = ["string_literal.cpp"],
  81. hdrs = ["string_literal.h"],
  82. deps = [
  83. ":character_set",
  84. "//common:check",
  85. "//toolchain/diagnostics:diagnostic_emitter",
  86. "@llvm-project//llvm:Support",
  87. ],
  88. )
  89. cc_test(
  90. name = "string_literal_test",
  91. size = "small",
  92. srcs = ["string_literal_test.cpp"],
  93. deps = [
  94. ":string_literal",
  95. ":test_helpers",
  96. "//common:ostream",
  97. "//toolchain/diagnostics:diagnostic_emitter",
  98. "@com_google_googletest//:gtest_main",
  99. "@llvm-project//llvm:Support",
  100. ],
  101. )
  102. cc_fuzz_test(
  103. name = "string_literal_fuzzer",
  104. size = "small",
  105. srcs = ["string_literal_fuzzer.cpp"],
  106. corpus = glob(["fuzzer_corpus/string_literal/*"]),
  107. deps = [
  108. ":string_literal",
  109. "//toolchain/diagnostics:diagnostic_emitter",
  110. "//toolchain/diagnostics:null_diagnostics",
  111. "@llvm-project//llvm:Support",
  112. ],
  113. )
  114. cc_library(
  115. name = "tokenized_buffer",
  116. srcs = ["tokenized_buffer.cpp"],
  117. hdrs = ["tokenized_buffer.h"],
  118. deps = [
  119. ":character_set",
  120. ":numeric_literal",
  121. ":string_literal",
  122. ":token_kind",
  123. "//common:check",
  124. "//common:ostream",
  125. "//toolchain/diagnostics:diagnostic_emitter",
  126. "//toolchain/source:source_buffer",
  127. "@llvm-project//llvm:Support",
  128. ],
  129. )
  130. cc_library(
  131. name = "tokenized_buffer_test_helpers",
  132. testonly = 1,
  133. hdrs = ["tokenized_buffer_test_helpers.h"],
  134. deps = [
  135. ":tokenized_buffer",
  136. "@com_google_googletest//:gtest",
  137. "@llvm-project//llvm:Support",
  138. ],
  139. )
  140. cc_test(
  141. name = "tokenized_buffer_test",
  142. size = "small",
  143. srcs = ["tokenized_buffer_test.cpp"],
  144. deps = [
  145. ":tokenized_buffer",
  146. ":tokenized_buffer_test_helpers",
  147. "//toolchain/common:yaml_test_helpers",
  148. "//toolchain/diagnostics:diagnostic_emitter",
  149. "//toolchain/diagnostics:mocks",
  150. "@com_google_googletest//:gtest_main",
  151. "@llvm-project//llvm:Support",
  152. ],
  153. )
  154. cc_fuzz_test(
  155. name = "tokenized_buffer_fuzzer",
  156. size = "small",
  157. srcs = ["tokenized_buffer_fuzzer.cpp"],
  158. corpus = glob(["fuzzer_corpus/tokenized_buffer/*"]),
  159. deps = [
  160. ":tokenized_buffer",
  161. "//common:check",
  162. "//toolchain/diagnostics:diagnostic_emitter",
  163. "//toolchain/diagnostics:null_diagnostics",
  164. "@llvm-project//llvm:Support",
  165. ],
  166. )