Skip to content

Commit

Permalink
[clang][Interp][NFC] Fix Pointer::isZero() for block pointers
Browse files Browse the repository at this point in the history
We don't need to consider the offset here anymore since we now
have proper integral pointers.
  • Loading branch information
tbaederr committed Apr 16, 2024
1 parent aae08f4 commit ca4cf97
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions clang/lib/AST/Interp/Pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,10 @@ class Pointer {

/// Checks if the pointer is null.
bool isZero() const {
if (Offset != 0)
return false;

if (isBlockPointer())
return asBlockPointer().Pointee == nullptr;
assert(isIntegralPointer());
return asIntPointer().Value == 0;
return asIntPointer().Value == 0 && Offset == 0;
}
/// Checks if the pointer is live.
bool isLive() const {
Expand Down

0 comments on commit ca4cf97

Please sign in to comment.