node_stack.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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. #ifndef CARBON_TOOLCHAIN_CHECK_NODE_STACK_H_
  5. #define CARBON_TOOLCHAIN_CHECK_NODE_STACK_H_
  6. #include <type_traits>
  7. #include "common/vlog.h"
  8. #include "llvm/ADT/SmallVector.h"
  9. #include "toolchain/parse/node_kind.h"
  10. #include "toolchain/parse/tree.h"
  11. #include "toolchain/sem_ir/inst.h"
  12. namespace Carbon::Check {
  13. // Wraps the stack of parse nodes for Context. Each parse node can have an
  14. // associated id of some kind (instruction, instruction block, function, class,
  15. // ...).
  16. //
  17. // All pushes and pops will be vlogged.
  18. //
  19. // Pop APIs will run basic verification:
  20. //
  21. // - If receiving a pop_parse_kind, verify that the parse_node being popped is
  22. // of pop_parse_kind.
  23. // - Validates presence of inst_id based on whether it's a solo
  24. // parse_node.
  25. //
  26. // These should be assumed API constraints unless otherwise mentioned on a
  27. // method. The main exception is PopAndIgnore, which doesn't do verification.
  28. class NodeStack {
  29. public:
  30. explicit NodeStack(const Parse::Tree& parse_tree,
  31. llvm::raw_ostream* vlog_stream)
  32. : parse_tree_(&parse_tree), vlog_stream_(vlog_stream) {}
  33. // Pushes a solo parse tree node onto the stack. Used when there is no
  34. // IR generated by the node.
  35. auto Push(Parse::NodeId parse_node) -> void {
  36. auto kind = parse_tree_->node_kind(parse_node);
  37. CARBON_CHECK(ParseNodeKindToIdKind(kind) == IdKind::SoloParseNode)
  38. << "Parse kind expects an Id: " << kind;
  39. CARBON_VLOG() << "Node Push " << stack_.size() << ": " << kind
  40. << " -> <none>\n";
  41. CARBON_CHECK(stack_.size() < (1 << 20))
  42. << "Excessive stack size: likely infinite loop";
  43. stack_.push_back(Entry(parse_node, SemIR::InstId::Invalid));
  44. }
  45. // Pushes a parse tree node onto the stack with an ID.
  46. template <typename IdT>
  47. auto Push(Parse::NodeId parse_node, IdT id) -> void {
  48. auto kind = parse_tree_->node_kind(parse_node);
  49. CARBON_CHECK(ParseNodeKindToIdKind(kind) == IdTypeToIdKind<IdT>())
  50. << "Parse kind expected a different IdT: " << kind << " -> " << id
  51. << "\n";
  52. CARBON_CHECK(id.is_valid()) << "Push called with invalid id: "
  53. << parse_tree_->node_kind(parse_node);
  54. CARBON_VLOG() << "Node Push " << stack_.size() << ": " << kind << " -> "
  55. << id << "\n";
  56. CARBON_CHECK(stack_.size() < (1 << 20))
  57. << "Excessive stack size: likely infinite loop";
  58. stack_.push_back(Entry(parse_node, id));
  59. }
  60. // Returns whether there is a node of the specified kind on top of the stack.
  61. auto PeekIs(Parse::NodeKind kind) const -> bool {
  62. return !stack_.empty() && PeekParseNodeKind() == kind;
  63. }
  64. // Returns whether there is a node of the specified kind on top of the stack.
  65. // Templated for consistency with other functions taking a parse node kind.
  66. template <const Parse::NodeKind& RequiredParseKind>
  67. auto PeekIs() const -> bool {
  68. return PeekIs(RequiredParseKind);
  69. }
  70. // Returns whether there is a name on top of the stack.
  71. auto PeekIsName() const -> bool {
  72. return !stack_.empty() &&
  73. ParseNodeKindToIdKind(PeekParseNodeKind()) == IdKind::NameId;
  74. }
  75. // Pops the top of the stack without any verification.
  76. auto PopAndIgnore() -> void {
  77. Entry back = stack_.pop_back_val();
  78. CARBON_VLOG() << "Node Pop " << stack_.size() << ": "
  79. << parse_tree_->node_kind(back.parse_node)
  80. << " -> <ignored>\n";
  81. }
  82. // Pops the top of the stack and returns the parse_node.
  83. template <const Parse::NodeKind& RequiredParseKind>
  84. auto PopForSoloParseNode() -> Parse::NodeIdForKind<RequiredParseKind> {
  85. Entry back = PopEntry<SemIR::InstId>();
  86. RequireIdKind(RequiredParseKind, IdKind::SoloParseNode);
  87. RequireParseKind<RequiredParseKind>(back.parse_node);
  88. return Parse::NodeIdForKind<RequiredParseKind>(back.parse_node);
  89. }
  90. // Pops the top of the stack if it is the given kind, and returns the
  91. // parse_node. Otherwise, returns std::nullopt.
  92. template <const Parse::NodeKind& RequiredParseKind>
  93. auto PopForSoloParseNodeIf()
  94. -> std::optional<Parse::NodeIdForKind<RequiredParseKind>> {
  95. if (PeekIs<RequiredParseKind>()) {
  96. return PopForSoloParseNode<RequiredParseKind>();
  97. }
  98. return std::nullopt;
  99. }
  100. // Pops the top of the stack.
  101. template <const Parse::NodeKind& RequiredParseKind>
  102. auto PopAndDiscardSoloParseNode() -> void {
  103. PopForSoloParseNode<RequiredParseKind>();
  104. }
  105. // Pops the top of the stack if it is the given kind. Returns `true` if a node
  106. // was popped.
  107. template <const Parse::NodeKind& RequiredParseKind>
  108. auto PopAndDiscardSoloParseNodeIf() -> bool {
  109. if (!PeekIs<RequiredParseKind>()) {
  110. return false;
  111. }
  112. PopForSoloParseNode<RequiredParseKind>();
  113. return true;
  114. }
  115. // Pops an expression from the top of the stack and returns the parse_node and
  116. // the ID.
  117. auto PopExprWithParseNode() -> std::pair<Parse::NodeId, SemIR::InstId> {
  118. return PopWithParseNode<SemIR::InstId>();
  119. }
  120. // Pops a name from the top of the stack and returns the parse_node and
  121. // the ID.
  122. auto PopNameWithParseNode() -> std::pair<Parse::NodeId, SemIR::NameId> {
  123. return PopWithParseNode<SemIR::NameId>();
  124. }
  125. // Pops the top of the stack and returns the parse_node and the ID.
  126. template <const Parse::NodeKind& RequiredParseKind>
  127. auto PopWithParseNode() -> auto {
  128. constexpr IdKind RequiredIdKind = ParseNodeKindToIdKind(RequiredParseKind);
  129. auto NodeIdCast = [&](auto back) {
  130. using NodeIdT = Parse::NodeIdForKind<RequiredParseKind>;
  131. return std::pair<NodeIdT, decltype(back.second)>(back);
  132. };
  133. if constexpr (RequiredIdKind == IdKind::InstId) {
  134. auto back = PopWithParseNode<SemIR::InstId>();
  135. RequireParseKind<RequiredParseKind>(back.first);
  136. return NodeIdCast(back);
  137. }
  138. if constexpr (RequiredIdKind == IdKind::InstBlockId) {
  139. auto back = PopWithParseNode<SemIR::InstBlockId>();
  140. RequireParseKind<RequiredParseKind>(back.first);
  141. return NodeIdCast(back);
  142. }
  143. if constexpr (RequiredIdKind == IdKind::FunctionId) {
  144. auto back = PopWithParseNode<SemIR::FunctionId>();
  145. RequireParseKind<RequiredParseKind>(back.first);
  146. return NodeIdCast(back);
  147. }
  148. if constexpr (RequiredIdKind == IdKind::ClassId) {
  149. auto back = PopWithParseNode<SemIR::ClassId>();
  150. RequireParseKind<RequiredParseKind>(back.first);
  151. return NodeIdCast(back);
  152. }
  153. if constexpr (RequiredIdKind == IdKind::InterfaceId) {
  154. auto back = PopWithParseNode<SemIR::InterfaceId>();
  155. RequireParseKind<RequiredParseKind>(back.first);
  156. return NodeIdCast(back);
  157. }
  158. if constexpr (RequiredIdKind == IdKind::NameId) {
  159. auto back = PopWithParseNode<SemIR::NameId>();
  160. RequireParseKind<RequiredParseKind>(back.first);
  161. return NodeIdCast(back);
  162. }
  163. if constexpr (RequiredIdKind == IdKind::TypeId) {
  164. auto back = PopWithParseNode<SemIR::TypeId>();
  165. RequireParseKind<RequiredParseKind>(back.first);
  166. return NodeIdCast(back);
  167. }
  168. CARBON_FATAL() << "Unpoppable IdKind for parse kind: " << RequiredParseKind
  169. << "; see value in ParseNodeKindToIdKind";
  170. }
  171. // Pops the top of the stack and returns the parse_node and the ID if it is
  172. // of the specified kind.
  173. template <const Parse::NodeKind& RequiredParseKind>
  174. auto PopWithParseNodeIf()
  175. -> std::optional<decltype(PopWithParseNode<RequiredParseKind>())> {
  176. if (!PeekIs<RequiredParseKind>()) {
  177. return std::nullopt;
  178. }
  179. return PopWithParseNode<RequiredParseKind>();
  180. }
  181. // Pops an expression from the top of the stack and returns the ID.
  182. // Expressions map multiple Parse::NodeKinds to SemIR::InstId always.
  183. auto PopExpr() -> SemIR::InstId { return PopExprWithParseNode().second; }
  184. // Pops a name from the top of the stack and returns the ID.
  185. auto PopName() -> SemIR::NameId { return PopNameWithParseNode().second; }
  186. // TODO: Can we add a `Pop<...>` that takes a parse node category? See
  187. // https://github.com/carbon-language/carbon-lang/pull/3534/files#r1432067519
  188. // Pops the top of the stack and returns the ID.
  189. template <const Parse::NodeKind& RequiredParseKind>
  190. auto Pop() -> auto {
  191. return PopWithParseNode<RequiredParseKind>().second;
  192. }
  193. // Pops the top of the stack if it has the given kind, and returns the ID.
  194. // Otherwise returns std::nullopt.
  195. template <const Parse::NodeKind& RequiredParseKind>
  196. auto PopIf() -> std::optional<decltype(Pop<RequiredParseKind>())> {
  197. if (PeekIs<RequiredParseKind>()) {
  198. return Pop<RequiredParseKind>();
  199. }
  200. return std::nullopt;
  201. }
  202. // Peeks at the parse node of the top of the node stack.
  203. auto PeekParseNode() const -> Parse::NodeId {
  204. return stack_.back().parse_node;
  205. }
  206. // Peeks at the kind of the parse node of the top of the node stack.
  207. auto PeekParseNodeKind() const -> Parse::NodeKind {
  208. return parse_tree_->node_kind(PeekParseNode());
  209. }
  210. // Peeks at the ID associated with the top of the name stack.
  211. template <const Parse::NodeKind& RequiredParseKind>
  212. auto Peek() const -> auto {
  213. Entry back = stack_.back();
  214. RequireParseKind<RequiredParseKind>(back.parse_node);
  215. constexpr IdKind RequiredIdKind = ParseNodeKindToIdKind(RequiredParseKind);
  216. if constexpr (RequiredIdKind == IdKind::InstId) {
  217. return back.id<SemIR::InstId>();
  218. }
  219. if constexpr (RequiredIdKind == IdKind::InstBlockId) {
  220. return back.id<SemIR::InstBlockId>();
  221. }
  222. if constexpr (RequiredIdKind == IdKind::FunctionId) {
  223. return back.id<SemIR::FunctionId>();
  224. }
  225. if constexpr (RequiredIdKind == IdKind::ClassId) {
  226. return back.id<SemIR::ClassId>();
  227. }
  228. if constexpr (RequiredIdKind == IdKind::InterfaceId) {
  229. return back.id<SemIR::InterfaceId>();
  230. }
  231. if constexpr (RequiredIdKind == IdKind::NameId) {
  232. return back.id<SemIR::NameId>();
  233. }
  234. if constexpr (RequiredIdKind == IdKind::TypeId) {
  235. return back.id<SemIR::TypeId>();
  236. }
  237. CARBON_FATAL() << "Unpeekable IdKind for parse kind: " << RequiredParseKind
  238. << "; see value in ParseNodeKindToIdKind";
  239. }
  240. // Prints the stack for a stack dump.
  241. auto PrintForStackDump(llvm::raw_ostream& output) const -> void;
  242. auto empty() const -> bool { return stack_.empty(); }
  243. auto size() const -> size_t { return stack_.size(); }
  244. private:
  245. // Possible associated ID types.
  246. enum class IdKind : int8_t {
  247. InstId,
  248. InstBlockId,
  249. FunctionId,
  250. ClassId,
  251. InterfaceId,
  252. NameId,
  253. TypeId,
  254. // No associated ID type.
  255. SoloParseNode,
  256. // Not expected in the node stack.
  257. Unused,
  258. };
  259. // An entry in stack_.
  260. struct Entry {
  261. explicit Entry(Parse::NodeId parse_node, SemIR::InstId inst_id)
  262. : parse_node(parse_node), inst_id(inst_id) {}
  263. explicit Entry(Parse::NodeId parse_node, SemIR::InstBlockId inst_block_id)
  264. : parse_node(parse_node), inst_block_id(inst_block_id) {}
  265. explicit Entry(Parse::NodeId parse_node, SemIR::FunctionId function_id)
  266. : parse_node(parse_node), function_id(function_id) {}
  267. explicit Entry(Parse::NodeId parse_node, SemIR::ClassId class_id)
  268. : parse_node(parse_node), class_id(class_id) {}
  269. explicit Entry(Parse::NodeId parse_node, SemIR::InterfaceId interface_id)
  270. : parse_node(parse_node), interface_id(interface_id) {}
  271. explicit Entry(Parse::NodeId parse_node, SemIR::NameId name_id)
  272. : parse_node(parse_node), name_id(name_id) {}
  273. explicit Entry(Parse::NodeId parse_node, SemIR::TypeId type_id)
  274. : parse_node(parse_node), type_id(type_id) {}
  275. // Returns the appropriate ID basaed on type.
  276. template <typename T>
  277. auto id() -> T& {
  278. if constexpr (std::is_same<T, SemIR::InstId>()) {
  279. return inst_id;
  280. }
  281. if constexpr (std::is_same<T, SemIR::InstBlockId>()) {
  282. return inst_block_id;
  283. }
  284. if constexpr (std::is_same<T, SemIR::FunctionId>()) {
  285. return function_id;
  286. }
  287. if constexpr (std::is_same<T, SemIR::ClassId>()) {
  288. return class_id;
  289. }
  290. if constexpr (std::is_same<T, SemIR::InterfaceId>()) {
  291. return interface_id;
  292. }
  293. if constexpr (std::is_same<T, SemIR::NameId>()) {
  294. return name_id;
  295. }
  296. if constexpr (std::is_same<T, SemIR::TypeId>()) {
  297. return type_id;
  298. }
  299. }
  300. // The parse node associated with the stack entry.
  301. Parse::NodeId parse_node;
  302. // The entries will evaluate as invalid if and only if they're a solo
  303. // parse_node. Invalid is used instead of optional to save space.
  304. //
  305. // A discriminator isn't needed because the caller can determine which field
  306. // is used based on the Parse::NodeKind.
  307. union {
  308. SemIR::InstId inst_id;
  309. SemIR::InstBlockId inst_block_id;
  310. SemIR::FunctionId function_id;
  311. SemIR::ClassId class_id;
  312. SemIR::InterfaceId interface_id;
  313. SemIR::NameId name_id;
  314. SemIR::TypeId type_id;
  315. };
  316. };
  317. static_assert(sizeof(Entry) == 8, "Unexpected Entry size");
  318. // Translate a parse node kind to the enum ID kind it should always provide.
  319. static constexpr auto ParseNodeKindToIdKind(Parse::NodeKind kind) -> IdKind {
  320. switch (kind) {
  321. case Parse::NodeKind::Address:
  322. case Parse::NodeKind::ArrayExpr:
  323. case Parse::NodeKind::BindingPattern:
  324. case Parse::NodeKind::CallExpr:
  325. case Parse::NodeKind::CallExprStart:
  326. case Parse::NodeKind::IdentifierNameExpr:
  327. case Parse::NodeKind::IfExprThen:
  328. case Parse::NodeKind::IfExprElse:
  329. case Parse::NodeKind::IndexExpr:
  330. case Parse::NodeKind::MemberAccessExpr:
  331. case Parse::NodeKind::PackageExpr:
  332. case Parse::NodeKind::ParenExpr:
  333. case Parse::NodeKind::ReturnType:
  334. case Parse::NodeKind::SelfTypeNameExpr:
  335. case Parse::NodeKind::SelfValueNameExpr:
  336. case Parse::NodeKind::ShortCircuitOperandAnd:
  337. case Parse::NodeKind::ShortCircuitOperandOr:
  338. case Parse::NodeKind::ShortCircuitOperatorAnd:
  339. case Parse::NodeKind::ShortCircuitOperatorOr:
  340. case Parse::NodeKind::StructFieldValue:
  341. case Parse::NodeKind::StructLiteral:
  342. case Parse::NodeKind::StructFieldType:
  343. case Parse::NodeKind::StructTypeLiteral:
  344. case Parse::NodeKind::TupleLiteral:
  345. return IdKind::InstId;
  346. case Parse::NodeKind::IfCondition:
  347. case Parse::NodeKind::IfExprIf:
  348. case Parse::NodeKind::ImplicitParamList:
  349. case Parse::NodeKind::TuplePattern:
  350. case Parse::NodeKind::WhileCondition:
  351. case Parse::NodeKind::WhileConditionStart:
  352. return IdKind::InstBlockId;
  353. case Parse::NodeKind::FunctionDefinitionStart:
  354. return IdKind::FunctionId;
  355. case Parse::NodeKind::ClassDefinitionStart:
  356. return IdKind::ClassId;
  357. case Parse::NodeKind::InterfaceDefinitionStart:
  358. return IdKind::InterfaceId;
  359. case Parse::NodeKind::BaseName:
  360. case Parse::NodeKind::IdentifierName:
  361. case Parse::NodeKind::SelfValueName:
  362. return IdKind::NameId;
  363. case Parse::NodeKind::ArrayExprSemi:
  364. case Parse::NodeKind::ClassIntroducer:
  365. case Parse::NodeKind::CodeBlockStart:
  366. case Parse::NodeKind::ExprOpenParen:
  367. case Parse::NodeKind::FunctionIntroducer:
  368. case Parse::NodeKind::IfStatementElse:
  369. case Parse::NodeKind::ImplicitParamListStart:
  370. case Parse::NodeKind::InterfaceIntroducer:
  371. case Parse::NodeKind::LetIntroducer:
  372. case Parse::NodeKind::QualifiedName:
  373. case Parse::NodeKind::ReturnedModifier:
  374. case Parse::NodeKind::ReturnStatementStart:
  375. case Parse::NodeKind::ReturnVarModifier:
  376. case Parse::NodeKind::StructLiteralOrStructTypeLiteralStart:
  377. case Parse::NodeKind::TuplePatternStart:
  378. case Parse::NodeKind::VariableInitializer:
  379. case Parse::NodeKind::VariableIntroducer:
  380. return IdKind::SoloParseNode;
  381. // Use x-macros to handle boilerplate cases.
  382. #define CARBON_PARSE_NODE_KIND(...)
  383. #define CARBON_PARSE_NODE_KIND_INFIX_OPERATOR(Name, ...) \
  384. case Parse::NodeKind::InfixOperator##Name: \
  385. return IdKind::InstId;
  386. #define CARBON_PARSE_NODE_KIND_POSTFIX_OPERATOR(Name, ...) \
  387. case Parse::NodeKind::PostfixOperator##Name: \
  388. return IdKind::InstId;
  389. #define CARBON_PARSE_NODE_KIND_PREFIX_OPERATOR(Name, ...) \
  390. case Parse::NodeKind::PrefixOperator##Name: \
  391. return IdKind::InstId;
  392. #define CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(Name, ...) \
  393. case Parse::NodeKind::Name: \
  394. return IdKind::InstId;
  395. #define CARBON_PARSE_NODE_KIND_TOKEN_MODIFIER(Name, ...) \
  396. case Parse::NodeKind::Name##Modifier: \
  397. return IdKind::SoloParseNode;
  398. #include "toolchain/parse/node_kind.def"
  399. default:
  400. return IdKind::Unused;
  401. }
  402. }
  403. // Translates an ID type to the enum ID kind for comparison with
  404. // ParseNodeKindToIdKind.
  405. template <typename IdT>
  406. static constexpr auto IdTypeToIdKind() -> IdKind {
  407. if constexpr (std::is_same_v<IdT, SemIR::InstId>) {
  408. return IdKind::InstId;
  409. }
  410. if constexpr (std::is_same_v<IdT, SemIR::InstBlockId>) {
  411. return IdKind::InstBlockId;
  412. }
  413. if constexpr (std::is_same_v<IdT, SemIR::FunctionId>) {
  414. return IdKind::FunctionId;
  415. }
  416. if constexpr (std::is_same_v<IdT, SemIR::ClassId>) {
  417. return IdKind::ClassId;
  418. }
  419. if constexpr (std::is_same_v<IdT, SemIR::InterfaceId>) {
  420. return IdKind::InterfaceId;
  421. }
  422. if constexpr (std::is_same_v<IdT, SemIR::NameId>) {
  423. return IdKind::NameId;
  424. }
  425. if constexpr (std::is_same_v<IdT, SemIR::TypeId>) {
  426. return IdKind::TypeId;
  427. }
  428. }
  429. // Pops an entry.
  430. template <typename IdT>
  431. auto PopEntry() -> Entry {
  432. Entry back = stack_.pop_back_val();
  433. CARBON_VLOG() << "Node Pop " << stack_.size() << ": "
  434. << parse_tree_->node_kind(back.parse_node) << " -> "
  435. << back.id<IdT>() << "\n";
  436. return back;
  437. }
  438. // Pops the top of the stack and returns the parse_node and the ID.
  439. template <typename IdT>
  440. auto PopWithParseNode() -> std::pair<Parse::NodeId, IdT> {
  441. Entry back = PopEntry<IdT>();
  442. RequireIdKind(parse_tree_->node_kind(back.parse_node),
  443. IdTypeToIdKind<IdT>());
  444. return {back.parse_node, back.id<IdT>()};
  445. }
  446. // Require a Parse::NodeKind be mapped to a particular IdKind.
  447. auto RequireIdKind(Parse::NodeKind parse_kind, IdKind id_kind) const -> void {
  448. CARBON_CHECK(ParseNodeKindToIdKind(parse_kind) == id_kind)
  449. << "Unexpected IdKind mapping for " << parse_kind;
  450. }
  451. // Require an entry to have the given Parse::NodeKind.
  452. template <const Parse::NodeKind& RequiredParseKind>
  453. auto RequireParseKind(Parse::NodeId parse_node) const -> void {
  454. auto actual_kind = parse_tree_->node_kind(parse_node);
  455. CARBON_CHECK(RequiredParseKind == actual_kind)
  456. << "Expected " << RequiredParseKind << ", found " << actual_kind;
  457. }
  458. // The file's parse tree.
  459. const Parse::Tree* parse_tree_;
  460. // Whether to print verbose output.
  461. llvm::raw_ostream* vlog_stream_;
  462. // The actual stack.
  463. // PushEntry and PopEntry control modification in order to centralize
  464. // vlogging.
  465. llvm::SmallVector<Entry> stack_;
  466. };
  467. } // namespace Carbon::Check
  468. #endif // CARBON_TOOLCHAIN_CHECK_NODE_STACK_H_