Skip to content

Commit 0ef12ec

Browse files
committed
SIL: Replace some calls to getDeclaredType() with getDeclaredInterfaceType()
1 parent 45fc0bc commit 0ef12ec

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

lib/SIL/IR/SILDefaultWitnessTable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ convertToDefinition(ArrayRef<Entry> entries) {
9797

9898
std::string SILDefaultWitnessTable::getUniqueName() const {
9999
Mangle::ASTMangler Mangler;
100-
return Mangler.mangleTypeWithoutPrefix(getProtocol()->getDeclaredType());
100+
return Mangler.mangleTypeWithoutPrefix(
101+
getProtocol()->getDeclaredInterfaceType());
101102
}
102103

103104
SILDefaultWitnessTable::~SILDefaultWitnessTable() {

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,8 @@ class SubstFunctionTypeCollector {
11771177
for (unsigned i : indices(upperBoundConformances)) {
11781178
auto proto = upperBoundConformances[i];
11791179
auto conformance = substTypeConformances[i];
1180-
substRequirements.push_back(Requirement(RequirementKind::Conformance,
1181-
param, proto->getDeclaredType()));
1180+
substRequirements.push_back(Requirement(RequirementKind::Conformance, param,
1181+
proto->getDeclaredInterfaceType()));
11821182
substConformances.push_back(conformance);
11831183
}
11841184

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ SubstitutionMap getApplySubstitutionsFromParsed(
17801780
return conformance;
17811781

17821782
SP.P.diagnose(loc, diag::sil_substitution_mismatch, replacementType,
1783-
proto->getDeclaredType());
1783+
proto->getDeclaredInterfaceType());
17841784
failed = true;
17851785

17861786
return ProtocolConformanceRef(proto);

lib/SIL/Utils/DynamicCasts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static CanType getHashableExistentialType(ModuleDecl *M) {
205205
auto hashable =
206206
M->getASTContext().getProtocol(KnownProtocolKind::Hashable);
207207
if (!hashable) return CanType();
208-
return hashable->getDeclaredType()->getCanonicalType();
208+
return hashable->getDeclaredInterfaceType()->getCanonicalType();
209209
}
210210

211211
/// Check if a given type conforms to _BridgedToObjectiveC protocol.

lib/SILGen/SILGenExpr.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,7 @@ RValue SILGenFunction::emitAnyHashableErasure(SILLocation loc,
18681868
auto convertFn = SGM.getConvertToAnyHashable(loc);
18691869
if (!convertFn)
18701870
return emitUndefRValue(
1871-
loc, getASTContext().getAnyHashableDecl()->getDeclaredType());
1871+
loc, getASTContext().getAnyHashableDecl()->getDeclaredInterfaceType());
18721872

18731873
// Construct the substitution for T: Hashable.
18741874
auto subMap = SubstitutionMap::getProtocolSubstitutions(
@@ -2742,7 +2742,7 @@ static SILFunction *getOrCreateKeyPathGetter(SILGenModule &SGM,
27422742
params.push_back({loweredBaseTy, paramConvention});
27432743
auto &C = SGM.getASTContext();
27442744
if (!indexes.empty())
2745-
params.push_back({C.getUnsafeRawPointerDecl()->getDeclaredType()
2745+
params.push_back({C.getUnsafeRawPointerDecl()->getDeclaredInterfaceType()
27462746
->getCanonicalType(),
27472747
ParameterConvention::Direct_Unowned});
27482748

@@ -2893,7 +2893,7 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
28932893
: paramConvention});
28942894
// indexes
28952895
if (!indexes.empty())
2896-
params.push_back({C.getUnsafeRawPointerDecl()->getDeclaredType()
2896+
params.push_back({C.getUnsafeRawPointerDecl()->getDeclaredInterfaceType()
28972897
->getCanonicalType(),
28982898
ParameterConvention::Direct_Unowned});
28992899

@@ -3040,10 +3040,10 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
30403040
}
30413041

30423042
auto &C = SGM.getASTContext();
3043-
auto unsafeRawPointerTy = C.getUnsafeRawPointerDecl()->getDeclaredType()
3043+
auto unsafeRawPointerTy = C.getUnsafeRawPointerDecl()->getDeclaredInterfaceType()
30443044
->getCanonicalType();
3045-
auto boolTy = C.getBoolDecl()->getDeclaredType()->getCanonicalType();
3046-
auto intTy = C.getIntDecl()->getDeclaredType()->getCanonicalType();
3045+
auto boolTy = C.getBoolDecl()->getDeclaredInterfaceType()->getCanonicalType();
3046+
auto intTy = C.getIntDecl()->getDeclaredInterfaceType()->getCanonicalType();
30473047

30483048
auto hashableProto = C.getProtocol(KnownProtocolKind::Hashable);
30493049

lib/SILOptimizer/Differentiation/PullbackCloner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2823,7 +2823,7 @@ AllocStackInst *PullbackCloner::Implementation::getArrayAdjointElementBuffer(
28232823
auto *eltIndexLiteral =
28242824
builder.createIntegerLiteral(loc, builtinIntType, eltIndex);
28252825
auto intType = SILType::getPrimitiveObjectType(
2826-
ctx.getIntDecl()->getDeclaredType()->getCanonicalType());
2826+
ctx.getIntDecl()->getDeclaredInterfaceType()->getCanonicalType());
28272827
// %index_int = struct $Int (%index_literal)
28282828
auto *eltIndexInt = builder.createStruct(loc, intType, {eltIndexLiteral});
28292829
auto *swiftModule = getModule().getSwiftModule();

lib/SILOptimizer/Transforms/StringOptimization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ bool StringOptimization::run(SILFunction *F) {
108108
if (!stringDecl)
109109
return false;
110110
stringType = SILType::getPrimitiveObjectType(
111-
CanType(stringDecl->getDeclaredType()));
111+
stringDecl->getDeclaredInterfaceType()->getCanonicalType());
112112

113113
bool changed = false;
114114

lib/SILOptimizer/Utils/Existential.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ ConcreteExistentialInfo::ConcreteExistentialInfo(SILValue existential,
400400
// There is no ConcreteValue in this case.
401401

402402
/// Determine the ExistentialConformances and SubstitutionMap.
403-
ExistentialType = Protocol->getDeclaredType()->getCanonicalType();
403+
ExistentialType = Protocol->getDeclaredInterfaceType()->getCanonicalType();
404404
initializeSubstitutionMap(ProtocolConformanceRef(ConcreteConformance), M);
405405

406406
assert(isValid());

0 commit comments

Comments
 (0)