BUILD 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. package(default_visibility = ["//explorer:__subpackages__"])
  5. genrule(
  6. name = "ast_rtti",
  7. srcs = ["ast_rtti.txt"],
  8. outs = [
  9. "ast_rtti.h",
  10. "ast_rtti.cpp",
  11. ],
  12. cmd = "./$(location //explorer:gen_rtti)" +
  13. " $(location ast_rtti.txt)" +
  14. " $(location ast_rtti.h) $(location ast_rtti.cpp)" +
  15. " $(rootpath ast_rtti.h)",
  16. tools = ["//explorer:gen_rtti"],
  17. )
  18. cc_library(
  19. name = "ast_node",
  20. srcs = [
  21. "ast_node.cpp",
  22. "ast_rtti.cpp",
  23. ],
  24. hdrs = [
  25. "ast_node.h",
  26. "ast_rtti.h",
  27. ],
  28. deps = [
  29. "//explorer/common:source_location",
  30. "@llvm-project//llvm:Support",
  31. ],
  32. )
  33. cc_library(
  34. name = "ast",
  35. srcs = [
  36. "declaration.cpp",
  37. "expression.cpp",
  38. "member.cpp",
  39. "pattern.cpp",
  40. "statement.cpp",
  41. ],
  42. hdrs = [
  43. "ast.h",
  44. "declaration.h",
  45. "expression.h",
  46. "impl_binding.h",
  47. "member.h",
  48. "pattern.h",
  49. "return_term.h",
  50. "statement.h",
  51. ],
  52. deps = [
  53. ":ast_node",
  54. ":bindings",
  55. ":library_name",
  56. ":paren_contents",
  57. ":static_scope",
  58. ":value_category",
  59. "//common:check",
  60. "//common:indirect_value",
  61. "//common:ostream",
  62. "//explorer/common:arena",
  63. "//explorer/common:error_builders",
  64. "//explorer/common:nonnull",
  65. "//explorer/common:source_location",
  66. "@llvm-project//llvm:Support",
  67. ],
  68. )
  69. cc_library(
  70. name = "ast_test_matchers",
  71. testonly = 1,
  72. srcs = [
  73. "ast_test_matchers_internal.cpp",
  74. "ast_test_matchers_internal.h",
  75. ],
  76. hdrs = ["ast_test_matchers.h"],
  77. deps = [
  78. ":ast",
  79. ":ast_node",
  80. "@com_google_googletest//:gtest",
  81. "@llvm-project//llvm:Support",
  82. ],
  83. )
  84. cc_test(
  85. name = "ast_test_matchers_test",
  86. srcs = ["ast_test_matchers_test.cpp"],
  87. deps = [
  88. ":ast",
  89. ":ast_test_matchers",
  90. "//common:gtest_main",
  91. "//explorer/common:arena",
  92. "@com_google_googletest//:gtest",
  93. ],
  94. )
  95. cc_library(
  96. name = "bindings",
  97. srcs = ["bindings.cpp"],
  98. hdrs = ["bindings.h"],
  99. deps = [
  100. "//explorer/common:nonnull",
  101. ],
  102. )
  103. cc_test(
  104. name = "expression_test",
  105. srcs = ["expression_test.cpp"],
  106. deps = [
  107. ":ast",
  108. ":paren_contents",
  109. "//common:gtest_main",
  110. "//explorer/common:arena",
  111. "@com_google_googletest//:gtest",
  112. "@llvm-project//llvm:Support",
  113. ],
  114. )
  115. cc_library(
  116. name = "library_name",
  117. hdrs = ["library_name.h"],
  118. )
  119. cc_library(
  120. name = "paren_contents",
  121. hdrs = ["paren_contents.h"],
  122. deps = [
  123. "//explorer/common:error_builders",
  124. "//explorer/common:source_location",
  125. ],
  126. )
  127. cc_test(
  128. name = "pattern_test",
  129. srcs = ["pattern_test.cpp"],
  130. deps = [
  131. ":ast",
  132. ":paren_contents",
  133. "//common:gtest_main",
  134. "//explorer/common:arena",
  135. "@com_google_googletest//:gtest",
  136. "@llvm-project//llvm:Support",
  137. ],
  138. )
  139. cc_library(
  140. name = "static_scope",
  141. srcs = ["static_scope.cpp"],
  142. hdrs = ["static_scope.h"],
  143. deps = [
  144. ":ast_node",
  145. ":value_category",
  146. "//common:check",
  147. "//common:error",
  148. "//explorer/common:error_builders",
  149. "//explorer/common:nonnull",
  150. "//explorer/common:source_location",
  151. "@llvm-project//llvm:Support",
  152. ],
  153. )
  154. cc_library(
  155. name = "value_category",
  156. hdrs = ["value_category.h"],
  157. )