Skip to content

Commit 76eb8e3

Browse files
committed
[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.
1 parent 70caa31 commit 76eb8e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/AST/Interp/Pointer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ APValue Pointer::toAPValue() const {
8787

8888
if (isZero())
8989
return APValue(static_cast<const Expr *>(nullptr), CharUnits::Zero(), Path,
90-
false, /*IsNullPtr=*/false);
90+
/*IsOnePastEnd=*/false, /*IsNullPtr=*/true);
9191

9292
// Build the lvalue base from the block.
9393
const Descriptor *Desc = getDeclDesc();
@@ -100,7 +100,8 @@ APValue Pointer::toAPValue() const {
100100
llvm_unreachable("Invalid allocation type");
101101

102102
if (isDummy() || isUnknownSizeArray() || Desc->asExpr())
103-
return APValue(Base, CharUnits::Zero(), Path, false, false);
103+
return APValue(Base, CharUnits::Zero(), Path,
104+
/*IsOnePastEnd=*/false, /*IsNullPtr=*/false);
104105

105106
// TODO: compute the offset into the object.
106107
CharUnits Offset = CharUnits::Zero();

0 commit comments

Comments
 (0)