Skip to content

Commit 5d58801

Browse files
committed
Add an explicit test for an invalid ManagedValue.
1 parent 537770c commit 5d58801

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/SILGen/ManagedValue.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class ManagedValue {
9090
}
9191

9292
public:
93+
/// Constructs an invalid ManagedValue.
9394
ManagedValue() = default;
9495

9596
/// Sometimes SILGen wants to represent an owned value or owned address
@@ -251,6 +252,10 @@ class ManagedValue {
251252
return ManagedValue(SILValue(), true, CleanupHandle::invalid());
252253
}
253254

255+
bool isValid() const {
256+
return valueAndFlag.getInt() || valueAndFlag.getPointer();
257+
}
258+
254259
bool isLValue() const {
255260
return valueAndFlag.getInt() && valueAndFlag.getPointer();
256261
}

0 commit comments

Comments
 (0)