mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Rename mutable accessor in InstBlock store. (#4659)
Mutating a block is a strange and rare operation and shouldn't have an innocuous name like `Get`.
This commit is contained in:
@@ -50,8 +50,10 @@ class BlockValueStore : public Yaml::Printable<BlockValueStore<IdT>> {
|
||||
return values_.Get(id);
|
||||
}
|
||||
|
||||
// Returns the requested block.
|
||||
auto Get(IdT id) -> llvm::MutableArrayRef<ElementType> {
|
||||
// Returns a mutable view of the requested block. This operation should be
|
||||
// avoided where possible; we generally want blocks to be immutable once
|
||||
// created.
|
||||
auto GetMutable(IdT id) -> llvm::MutableArrayRef<ElementType> {
|
||||
return values_.Get(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class CopyOnWriteBlock {
|
||||
if (id_ == source_id_) {
|
||||
id_ = (file_.*ValueStore)().Add((file_.*ValueStore)().Get(source_id_));
|
||||
}
|
||||
(file_.*ValueStore)().Get(id_)[i] = value;
|
||||
(file_.*ValueStore)().GetMutable(id_)[i] = value;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user