mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Replacing lowering vectors with FixedSizeValueStore (#5636)
Changes the vectors on `Lower::FileContext` to be `FixedSizeValueStore` where possible, which we have several at this point. This changes `FixedSizeValueStore` to prefer inferring the size from a `ValueStore<IdT>`, which should make adding incorrect sizes harder. Note I wasn't sure that adding a `size()` to `TypeStore` that returned `insts().size()` would be good because it doesn't directly work that way; `ConstantValueStore` would've also required more work since it doesn't have access to that right now.
This commit is contained in:
@@ -16,7 +16,8 @@ TreeAndSubtrees::TreeAndSubtrees(const Lex::TokenizedBuffer& tokens,
|
||||
const Tree& tree)
|
||||
: tokens_(&tokens),
|
||||
tree_(&tree),
|
||||
subtree_sizes_(SubtreeSizeStore::MakeForOverwrite(tree_->size())) {
|
||||
subtree_sizes_(
|
||||
SubtreeSizeStore::MakeForOverwriteWithExplicitSize(tree_->size())) {
|
||||
// A stack of nodes which haven't yet been used as children.
|
||||
llvm::SmallVector<NodeId> size_stack;
|
||||
for (auto n : tree.postorder()) {
|
||||
|
||||
Reference in New Issue
Block a user