Skip to content

Commit bb97dbf

Browse files
committed
SIL: Add asserts to isFormally{Passed,Returned}Indirectly()
We want to be sure to only use types lowerered with ResilienceExpansion::Minimal when computing function signatures.
1 parent 8fbf3ab commit bb97dbf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/swift/SIL/TypeLowering.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,22 @@ class TypeLowering {
250250
/// convention?
251251
///
252252
/// This is independent of whether the SIL argument is address type.
253-
bool isFormallyPassedIndirectly() const { return isAddressOnly(); }
253+
bool isFormallyPassedIndirectly() const {
254+
assert(!isResilient() ||
255+
getResilienceExpansion() == ResilienceExpansion::Minimal &&
256+
"calling convention uses minimal resilience expansion");
257+
return isAddressOnly();
258+
}
254259

255260
/// Are r-values of this type returned indirectly by formal convention?
256261
///
257262
/// This is independent of whether the SIL result is address type.
258-
bool isFormallyReturnedIndirectly() const { return isAddressOnly(); }
263+
bool isFormallyReturnedIndirectly() const {
264+
assert(!isResilient() ||
265+
getResilienceExpansion() == ResilienceExpansion::Minimal &&
266+
"calling convention uses minimal resilience expansion");
267+
return isAddressOnly();
268+
}
259269

260270
RecursiveProperties getRecursiveProperties() const {
261271
return Properties;

0 commit comments

Comments
 (0)