You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Back in 33f4f57 of
#28044 fame,
non-`CaptureKind::Constant:` uses of `Entry.val` in
`SILGenFunction::emitCaptures` were replaced with a use of the newly
added lambda `getAddressValue` applied at `Entry.val`.
The replacement of `Entry.value` with `getAddressValue(Entry.value)` in
the case of `CaptureKind::Box` had no effect.
Back then, the reason was that the condition
SGM.Types
.getTypeLowering(
valueType,
TypeExpansionContext::noOpaqueTypeArchetypesSubstitution(
expansion.getResilienceExpansion()))
.isAddressOnly() &&
!entryValue->getType().isAddress()
under which something other than the input was returned would never
hold: CaptureKind::Box is used for LValues and those never satisfy
`!entryValue->getType().isAddress()`.
Since that PR, the getAddressValue lambda has grown. There are two
additional aspects to consider: (1) forceCopy, (2) isPack. (1) is not
relevant because `false` was being passed for the `CaptureKind::Box`
case. (2) can not currently happen because pack lvalues haven't been
implemented. But even if they were implemented, the argument passed to
the lambda would still need to be an address.
The same all holds for the `CaptureKind::ImmutableBox` case which only
differs from the `CaptureKind::Box` by a couple of lines.
0 commit comments