Skip to content

Commit 75aefee

Browse files
committed
---
yaml --- r: 344061 b: refs/heads/master-rebranch c: 533d41d h: refs/heads/master i: 344059: 86b162b
1 parent 868d537 commit 75aefee

File tree

12 files changed

+176
-152
lines changed

12 files changed

+176
-152
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14551455
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14561456
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14571457
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1458-
refs/heads/master-rebranch: b8642b0965476b9707a7089c2b46fc2aec132888
1458+
refs/heads/master-rebranch: 533d41d0db7efc4d3b1ee28cbec121b8fc22ff47
14591459
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14601460
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14611461
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec

branches/master-rebranch/include/swift/SIL/TypeLowering.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ class TypeConverter {
689689

690690
llvm::DenseMap<OverrideKey, SILConstantInfo *> ConstantOverrideTypes;
691691

692-
llvm::DenseMap<AnyFunctionRef, CaptureInfo> LoweredCaptures;
692+
llvm::DenseMap<SILDeclRef, CaptureInfo> LoweredCaptures;
693693

694694
/// Cache of loadable SILType to number of (estimated) fields
695695
///
@@ -896,11 +896,6 @@ class TypeConverter {
896896
SILType getEmptyTupleType() {
897897
return SILType::getPrimitiveObjectType(TupleType::getEmpty(Context));
898898
}
899-
900-
/// Get a function type curried with its capture context.
901-
CanAnyFunctionType getFunctionInterfaceTypeWithCaptures(
902-
CanAnyFunctionType funcType,
903-
AnyFunctionRef closure);
904899

905900
/// Describes what we're trying to compute a bridged type for.
906901
///
@@ -972,10 +967,10 @@ class TypeConverter {
972967
CanType get##BridgedType##Type();
973968
#include "swift/SIL/BridgedTypes.def"
974969

975-
/// Get the capture list from a closure, with transitive function captures
976-
/// flattened.
977-
CaptureInfo getLoweredLocalCaptures(AnyFunctionRef fn);
978-
bool hasLoweredLocalCaptures(AnyFunctionRef fn);
970+
/// Get the capture list for a function or default argument, with transitive
971+
/// function captures flattened.
972+
CaptureInfo getLoweredLocalCaptures(SILDeclRef fn);
973+
bool hasLoweredLocalCaptures(SILDeclRef fn);
979974

980975
enum class ABIDifference : uint8_t {
981976
// No ABI differences, function can be trivially bitcast to result type.

branches/master-rebranch/lib/SIL/SILFunctionType.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ static std::pair<AbstractionPattern, CanType> updateResultTypeForForeignError(
715715
/// If we ever add that ability, it will be a different capture list
716716
/// from the function to which the argument is attached.
717717
static void
718-
lowerCaptureContextParameters(TypeConverter &TC, AnyFunctionRef function,
718+
lowerCaptureContextParameters(TypeConverter &TC, SILDeclRef function,
719719
CanGenericSignature genericSig,
720720
ResilienceExpansion expansion,
721721
SmallVectorImpl<SILParameterInfo> &inputs) {
@@ -725,8 +725,7 @@ lowerCaptureContextParameters(TypeConverter &TC, AnyFunctionRef function,
725725
// canonicalize references to the generic parameters that may appear in
726726
// non-canonical types in that context. We need the original generic
727727
// signature from the AST for that.
728-
auto origGenericSig = function.getGenericSignature();
729-
728+
auto origGenericSig = function.getAnyFunctionRef()->getGenericSignature();
730729
auto loweredCaptures = TC.getLoweredLocalCaptures(function);
731730

732731
for (auto capture : loweredCaptures.getCaptures()) {
@@ -999,18 +998,12 @@ static CanSILFunctionType getSILFunctionType(
999998
yields, coroutineKind);
1000999

10011000
// Lower the capture context parameters, if any.
1002-
//
1003-
// *NOTE* Currently default arg generators can not capture anything.
1004-
// If we ever add that ability, it will be a different capture list
1005-
// from the function to which the argument is attached.
1006-
if (constant && !constant->isDefaultArgGenerator()) {
1007-
if (auto function = constant->getAnyFunctionRef()) {
1008-
auto expansion = ResilienceExpansion::Maximal;
1009-
if (constant->isSerialized())
1010-
expansion = ResilienceExpansion::Minimal;
1011-
lowerCaptureContextParameters(TC, *function, genericSig, expansion,
1012-
inputs);
1013-
}
1001+
if (constant && constant->getAnyFunctionRef()) {
1002+
auto expansion = ResilienceExpansion::Maximal;
1003+
if (constant->isSerialized())
1004+
expansion = ResilienceExpansion::Minimal;
1005+
lowerCaptureContextParameters(TC, *constant, genericSig, expansion,
1006+
inputs);
10141007
}
10151008

10161009
auto calleeConvention = ParameterConvention::Direct_Unowned;

0 commit comments

Comments
 (0)