Skip to content

Commit ca4cf97

Browse files
committed
[clang][Interp][NFC] Fix Pointer::isZero() for block pointers
We don't need to consider the offset here anymore since we now have proper integral pointers.
1 parent aae08f4 commit ca4cf97

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clang/lib/AST/Interp/Pointer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,10 @@ class Pointer {
241241

242242
/// Checks if the pointer is null.
243243
bool isZero() const {
244-
if (Offset != 0)
245-
return false;
246-
247244
if (isBlockPointer())
248245
return asBlockPointer().Pointee == nullptr;
249246
assert(isIntegralPointer());
250-
return asIntPointer().Value == 0;
247+
return asIntPointer().Value == 0 && Offset == 0;
251248
}
252249
/// Checks if the pointer is live.
253250
bool isLive() const {

0 commit comments

Comments
 (0)