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 {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to