BUILD 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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:node",
  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. "declaration_name_stack.cpp",
  33. "node_block_stack.cpp",
  34. ] +
  35. # Glob handler files to avoid missing any.
  36. glob([
  37. "handle*.cpp",
  38. ]),
  39. hdrs = [
  40. "check.h",
  41. "context.h",
  42. "convert.h",
  43. "declaration_name_stack.h",
  44. "node_block_stack.h",
  45. "pending_block.h",
  46. ],
  47. deps = [
  48. ":node_stack",
  49. "//common:check",
  50. "//common:ostream",
  51. "//common:vlog",
  52. "//toolchain/base:pretty_stack_trace_function",
  53. "//toolchain/diagnostics:diagnostic_emitter",
  54. "//toolchain/diagnostics:diagnostic_kind",
  55. "//toolchain/lex:tokenized_buffer",
  56. "//toolchain/parse:node_kind",
  57. "//toolchain/parse:tree",
  58. "//toolchain/parse:tree_node_location_translator",
  59. "//toolchain/sem_ir:builtin_kind",
  60. "//toolchain/sem_ir:file",
  61. "//toolchain/sem_ir:node",
  62. "//toolchain/sem_ir:node_kind",
  63. "@llvm-project//llvm:Support",
  64. ],
  65. )
  66. cc_fuzz_test(
  67. name = "check_fuzzer",
  68. size = "small",
  69. srcs = ["check_fuzzer.cpp"],
  70. corpus = glob(["fuzzer_corpus/*"]),
  71. deps = [
  72. "//toolchain/driver",
  73. "@llvm-project//llvm:Support",
  74. ],
  75. )
  76. glob_sh_run(
  77. args = [
  78. "$(location //toolchain/driver:carbon)",
  79. "compile",
  80. "--phase=check",
  81. "--dump-sem-ir",
  82. "--dump-raw-sem-ir",
  83. ],
  84. data = ["//toolchain/driver:carbon"],
  85. file_exts = ["carbon"],
  86. )
  87. glob_sh_run(
  88. args = [
  89. "$(location //toolchain/driver:carbon)",
  90. "-v",
  91. "compile",
  92. "--phase=check",
  93. ],
  94. data = ["//toolchain/driver:carbon"],
  95. file_exts = ["carbon"],
  96. run_ext = "verbose",
  97. )