BUILD 2.7 KB

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