Rename Ptr<T> to Nonnull<T*> (#832)

Note that ptr.h also includes an enable_if change, to help avoid https://bugs.llvm.org/show_bug.cgi?id=51881
This commit is contained in:
Jon Meow
2021-09-16 19:22:57 -07:00
committed by GitHub
parent 5e66248db0
commit 56dc4ae375
35 changed files with 584 additions and 535 deletions
+4 -3
View File
@@ -9,7 +9,7 @@
namespace Carbon {
auto Heap::AllocateValue(Ptr<const Value> v) -> Address {
auto Heap::AllocateValue(Nonnull<const Value*> v) -> Address {
// Putting the following two side effects together in this function
// ensures that we don't do anything else in between, which is really bad!
// Consider whether to include a copy of the input v in this function
@@ -20,12 +20,13 @@ auto Heap::AllocateValue(Ptr<const Value> v) -> Address {
return a;
}
auto Heap::Read(const Address& a, SourceLocation loc) -> Ptr<const Value> {
auto Heap::Read(const Address& a, SourceLocation loc) -> Nonnull<const Value*> {
this->CheckAlive(a, loc);
return values[a.index]->GetField(arena, a.field_path, loc);
}
void Heap::Write(const Address& a, Ptr<const Value> v, SourceLocation loc) {
void Heap::Write(const Address& a, Nonnull<const Value*> v,
SourceLocation loc) {
this->CheckAlive(a, loc);
values[a.index] = values[a.index]->SetField(arena, a.field_path, v, loc);
}