Skip to content

Commit eeec16f

Browse files
[NFC] Remove redundant ExtInfo parameter for getBridgedFunctionType.
At all call-sites, the extInfo passed as the third argument is computed directly from the second argument, so we compute it directly in getBridgedFunctionType.
1 parent eead4ae commit eeec16f

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

include/swift/SIL/TypeLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,6 @@ class TypeConverter {
992992
/// Given a function type, yield its bridged formal type.
993993
CanAnyFunctionType getBridgedFunctionType(AbstractionPattern fnPattern,
994994
CanAnyFunctionType fnType,
995-
AnyFunctionType::ExtInfo extInfo,
996995
Bridgeability bridging);
997996

998997
/// Given a referenced value and the substituted formal type of a

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,7 +3984,6 @@ SILFunctionType::substituteOpaqueArchetypes(TypeConverter &TC,
39843984
CanAnyFunctionType
39853985
TypeConverter::getBridgedFunctionType(AbstractionPattern pattern,
39863986
CanAnyFunctionType t,
3987-
AnyFunctionType::ExtInfo extInfo,
39883987
Bridgeability bridging) {
39893988
// Pull out the generic signature.
39903989
CanGenericSignature genericSig = t.getOptGenericSignature();
@@ -3996,12 +3995,8 @@ TypeConverter::getBridgedFunctionType(AbstractionPattern pattern,
39963995
case SILFunctionTypeRepresentation::Closure:
39973996
case SILFunctionTypeRepresentation::WitnessMethod: {
39983997
// No bridging needed for native functions.
3999-
if (t->getExtInfo().isEqualTo(extInfo, useClangTypes(t)))
4000-
return t;
4001-
return CanAnyFunctionType::get(genericSig, t.getParams(), t.getResult(),
4002-
extInfo);
3998+
return t;
40033999
}
4004-
40054000
case SILFunctionTypeRepresentation::CFunctionPointer:
40064001
case SILFunctionTypeRepresentation::Block:
40074002
case SILFunctionTypeRepresentation::ObjCMethod: {
@@ -4016,7 +4011,7 @@ TypeConverter::getBridgedFunctionType(AbstractionPattern pattern,
40164011
suppressOptional);
40174012

40184013
return CanAnyFunctionType::get(genericSig, llvm::makeArrayRef(params),
4019-
result, extInfo);
4014+
result, t->getExtInfo());
40204015
}
40214016
}
40224017
llvm_unreachable("bad calling convention");
@@ -4098,7 +4093,6 @@ TypeConverter::getLoweredFormalTypes(SILDeclRef constant,
40984093
auto bridging = Bridgeability::Full;
40994094

41004095
unsigned numParameterLists = constant.getParameterListCount();
4101-
auto extInfo = fnType->getExtInfo();
41024096

41034097
// Form an abstraction pattern for bridging purposes.
41044098
AbstractionPattern bridgingFnPattern =
@@ -4108,12 +4102,13 @@ TypeConverter::getLoweredFormalTypes(SILDeclRef constant,
41084102
// Fast path: no uncurrying required.
41094103
if (numParameterLists == 1) {
41104104
auto bridgedFnType =
4111-
getBridgedFunctionType(bridgingFnPattern, fnType, extInfo, bridging);
4105+
getBridgedFunctionType(bridgingFnPattern, fnType, bridging);
41124106
bridgingFnPattern.rewriteType(bridgingFnPattern.getGenericSignature(),
41134107
bridgedFnType);
41144108
return { bridgingFnPattern, bridgedFnType };
41154109
}
41164110

4111+
auto extInfo = fnType->getExtInfo();
41174112
SILFunctionTypeRepresentation rep = extInfo.getSILRepresentation();
41184113
assert(rep != SILFunctionType::Representation::Block
41194114
&& "objc blocks cannot be curried");

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ TypeConverter::computeLoweredRValueType(TypeExpansionContext forExpansion,
19641964

19651965
// Bridge the parameters and result of the function type.
19661966
auto bridgedFnType =
1967-
TC.getBridgedFunctionType(origType, substFnType, extInfo, bridging);
1967+
TC.getBridgedFunctionType(origType, substFnType, bridging);
19681968
substFnType = bridgedFnType;
19691969

19701970
// Also rewrite the type of the abstraction pattern.

lib/SILGen/SILGenApply.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ getIndirectApplyAbstractionPattern(SILGenFunction &SGF,
7676
// bridged to a foreign type.
7777
auto bridgedType =
7878
SGF.SGM.Types.getBridgedFunctionType(pattern, fnType,
79-
fnType->getExtInfo(),
8079
Bridgeability::Full);
8180
pattern.rewriteType(CanGenericSignature(), bridgedType);
8281
return pattern;

lib/SILGen/SILGenBridging.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ getParameterTypes(AnyFunctionType::CanParamArrayRef params) {
350350
static CanAnyFunctionType getBridgedBlockType(SILGenModule &SGM,
351351
CanAnyFunctionType blockType) {
352352
return SGM.Types.getBridgedFunctionType(AbstractionPattern(blockType),
353-
blockType, blockType->getExtInfo(),
354-
Bridgeability::Full);
353+
blockType, Bridgeability::Full);
355354
}
356355

357356
static void buildFuncToBlockInvokeBody(SILGenFunction &SGF,

0 commit comments

Comments
 (0)