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:
Richard Smith
2024-12-10 20:23:24 +00:00
committed by GitHub
parent eabe9f117a
commit d81ed4b58f
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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: