[clang] 76eb8e3 - [clang][Interp] Fix marking results as nullptr

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 12 08:11:11 PST 2024


Author: Timm Bäder
Date: 2024-02-12T17:10:19+01:00
New Revision: 76eb8e35d6631827c0450e9d5f4743e410d4151a

URL: https://github.com/llvm/llvm-project/commit/76eb8e35d6631827c0450e9d5f4743e410d4151a
DIFF: https://github.com/llvm/llvm-project/commit/76eb8e35d6631827c0450e9d5f4743e410d4151a.diff

LOG: [clang][Interp] Fix marking results as nullptr

I screwed this up in an earlier NFC commit, but the isZero()
case needs to set IsNullPtr to true of course.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Pointer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index d68af7922af5a..8a0a15547b0f2 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -87,7 +87,7 @@ APValue Pointer::toAPValue() const {
 
   if (isZero())
     return APValue(static_cast<const Expr *>(nullptr), CharUnits::Zero(), Path,
-                   false, /*IsNullPtr=*/false);
+                   /*IsOnePastEnd=*/false, /*IsNullPtr=*/true);
 
   // Build the lvalue base from the block.
   const Descriptor *Desc = getDeclDesc();
@@ -100,7 +100,8 @@ APValue Pointer::toAPValue() const {
     llvm_unreachable("Invalid allocation type");
 
   if (isDummy() || isUnknownSizeArray() || Desc->asExpr())
-    return APValue(Base, CharUnits::Zero(), Path, false, false);
+    return APValue(Base, CharUnits::Zero(), Path,
+                   /*IsOnePastEnd=*/false, /*IsNullPtr=*/false);
 
   // TODO: compute the offset into the object.
   CharUnits Offset = CharUnits::Zero();


        


More information about the cfe-commits mailing list