BUILD 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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("@rules_cc//cc:defs.bzl", "cc_library")
  5. load("//bazel/sh_run:rules.bzl", "glob_sh_run")
  6. load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
  7. package(default_visibility = ["//visibility:public"])
  8. filegroup(
  9. name = "testdata",
  10. data = glob(["testdata/**/*.carbon"]),
  11. )
  12. cc_library(
  13. name = "node_stack",
  14. srcs = ["node_stack.cpp"],
  15. hdrs = ["node_stack.h"],
  16. deps = [
  17. "//common:check",
  18. "//common:ostream",
  19. "//common:vlog",
  20. "//toolchain/parse:node_kind",
  21. "//toolchain/parse:tree",
  22. "//toolchain/sem_ir:inst",
  23. "@llvm-project//llvm:Support",
  24. ],
  25. )
  26. cc_library(
  27. name = "check",
  28. srcs = [
  29. "check.cpp",
  30. "context.cpp",
  31. "convert.cpp",
  32. "decl_name_stack.cpp",
  33. "inst_block_stack.cpp",
  34. "modifiers.cpp",
  35. "return.cpp",
  36. "return.h",
  37. ] +
  38. # Glob handler files to avoid missing any.
  39. glob([
  40. "handle*.cpp",
  41. ]),
  42. hdrs = [
  43. "check.h",
  44. "context.h",
  45. "convert.h",
  46. "decl_name_stack.h",
  47. "decl_state.h",
  48. "inst_block_stack.h",
  49. "modifiers.h",
  50. "pending_block.h",
  51. ],
  52. deps = [
  53. ":node_stack",
  54. "//common:check",
  55. "//common:ostream",
  56. "//common:vlog",
  57. "//toolchain/base:pretty_stack_trace_function",
  58. "//toolchain/base:value_store",
  59. "//toolchain/diagnostics:diagnostic_emitter",
  60. "//toolchain/diagnostics:diagnostic_kind",
  61. "//toolchain/lex:token_kind",
  62. "//toolchain/lex:tokenized_buffer",
  63. "//toolchain/parse:node_kind",
  64. "//toolchain/parse:tree",
  65. "//toolchain/parse:tree_node_location_translator",
  66. "//toolchain/sem_ir:builtin_kind",
  67. "//toolchain/sem_ir:entry_point",
  68. "//toolchain/sem_ir:file",
  69. "//toolchain/sem_ir:ids",
  70. "//toolchain/sem_ir:inst",
  71. "//toolchain/sem_ir:inst_kind",
  72. "@llvm-project//llvm:Support",
  73. ],
  74. )
  75. cc_fuzz_test(
  76. name = "check_fuzzer",
  77. size = "small",
  78. srcs = ["check_fuzzer.cpp"],
  79. corpus = glob(["fuzzer_corpus/*"]),
  80. deps = [
  81. "//toolchain/driver",
  82. "@llvm-project//llvm:Support",
  83. ],
  84. )
  85. glob_sh_run(
  86. args = [
  87. "$(location //toolchain/driver:carbon)",
  88. "compile",
  89. "--phase=check",
  90. "--dump-sem-ir",
  91. "--dump-raw-sem-ir",
  92. ],
  93. data = ["//toolchain/driver:carbon"],
  94. file_exts = ["carbon"],
  95. )
  96. glob_sh_run(
  97. args = [
  98. "$(location //toolchain/driver:carbon)",
  99. "-v",
  100. "compile",
  101. "--phase=check",
  102. ],
  103. data = ["//toolchain/driver:carbon"],
  104. file_exts = ["carbon"],
  105. run_ext = "verbose",
  106. )