BUILD 4.9 KB

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