[clang] ca4cf97 - [clang][Interp][NFC] Fix Pointer::isZero() for block pointers
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 16 02:45:36 PDT 2024
Author: Timm Bäder
Date: 2024-04-16T11:45:03+02:00
New Revision: ca4cf973279a3991248056a73bcb2bac8b37d035
URL: https://github.com/llvm/llvm-project/commit/ca4cf973279a3991248056a73bcb2bac8b37d035
DIFF: https://github.com/llvm/llvm-project/commit/ca4cf973279a3991248056a73bcb2bac8b37d035.diff
LOG: [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.
Added:
Modified:
clang/lib/AST/Interp/Pointer.h
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index fcd00aac62f93e..b4475577b74625 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -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 {
More information about the cfe-commits
mailing list