mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Based on discussion around the region handling in generic_region_stack, create a generic structure for the stack-of-vectors support. I also want to add this to InstBlockStack, but that's a little more complex due to GlobalInit, so cutting a PR here to check with review. My work here is how I noticed #4099; I want to be sure that I'm correct about the issue, but it's the difference between being able to use PeekArray or not. Note in scope_stack.h, I believe we could remove next_compile_time_index and make it just based on elements_size(). However, I want to verify with you before I make further changes there. --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
22 lines
709 B
C++
22 lines
709 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "toolchain/check/generic_region_stack.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
auto GenericRegionStack::Push() -> void { dependent_insts_stack_.PushArray(); }
|
|
|
|
auto GenericRegionStack::Pop() -> void { dependent_insts_stack_.PopArray(); }
|
|
|
|
auto GenericRegionStack::AddDependentInst(DependentInst inst) -> void {
|
|
dependent_insts_stack_.AppendToTop(inst);
|
|
}
|
|
|
|
auto GenericRegionStack::PeekDependentInsts() -> llvm::ArrayRef<DependentInst> {
|
|
return dependent_insts_stack_.PeekArray();
|
|
}
|
|
|
|
} // namespace Carbon::Check
|