Skip to content

Commit 6920290

Browse files
committed
[silgen] Add an assert to ManagedValue::ManagedValue saying that objects with trivial ownership should never have a cleanup.
rdar://29791263
1 parent 7af65d9 commit 6920290

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILGen/ManagedValue.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ class ManagedValue {
7676
ManagedValue(SILValue value, CleanupHandle cleanup)
7777
: valueAndFlag(value, false), cleanup(cleanup) {
7878
assert(value && "No value specified?!");
79+
assert((!getType().isObject() ||
80+
value.getOwnershipKind() != ValueOwnershipKind::Trivial ||
81+
!hasCleanup()) &&
82+
"Objects with trivial ownership should never have a cleanup");
7983
}
8084

8185
/// Create a managed value for a +0 rvalue.

0 commit comments

Comments
 (0)