Skip to content

Commit

Permalink
Fix nullability annotation of `ReferenceCountingMemoryManager::Alloca…
Browse files Browse the repository at this point in the history
…te()`.

The declaration didn't have an annotation; the definition is annotated as
returning nonnull, but it contains a `return nullptr`.

For the time being, I'm fixing this by removing the annotation on the definition
(thereby making it consistent with the declaration). Code owners may want to
follow up by marking both the definition and declaration as returning nullable
if desired.

PiperOrigin-RevId: 637786972
  • Loading branch information
martinboehme authored and copybara-github committed Jun 3, 2024
1 parent ca00b8a commit 4f87c84
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions common/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ std::ostream& operator<<(std::ostream& out,
}
}

absl::Nonnull<void*> ReferenceCountingMemoryManager::Allocate(
size_t size, size_t alignment) {
void* ReferenceCountingMemoryManager::Allocate(size_t size, size_t alignment) {
ABSL_DCHECK(absl::has_single_bit(alignment))
<< "alignment must be a power of 2: " << alignment;
if (size == 0) {
Expand Down

0 comments on commit 4f87c84

Please # to comment.