Skip to content

Commit a79c11f

Browse files
committed
Drop more uses of getInput() from SIL
1 parent ffedc8a commit a79c11f

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

lib/SIL/SILFunctionType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ TypeConverter::getConstantOverrideInfo(SILDeclRef derived, SILDeclRef base) {
22522252
auto overrideInterfaceFnTy = overrideInterfaceTy->castTo<FunctionType>();
22532253
overrideInterfaceTy =
22542254
GenericFunctionType::get(derivedInterfaceFnTy->getGenericSignature(),
2255-
overrideInterfaceFnTy->getInput(),
2255+
overrideInterfaceFnTy->getParams(),
22562256
overrideInterfaceFnTy->getResult(),
22572257
overrideInterfaceFnTy->getExtInfo());
22582258
}

lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5290,8 +5290,10 @@ emitMaterializeForSetAccessor(SILLocation loc, SILDeclRef materializeForSet,
52905290

52915291
auto origAccessType = SGM.Types.getConstantInfo(materializeForSet).FormalType;
52925292

5293-
auto origSelfType = origAccessType->getInput()
5294-
->getInOutObjectType()
5293+
assert(origAccessType->getParams().size() == 1 &&
5294+
"more than one self parameter?");
5295+
auto origSelfType = origAccessType
5296+
->getParams()[0].getPlainType()
52955297
->getCanonicalType();
52965298

52975299
CanGenericSignature genericSig;

lib/SILGen/SILGenConstructor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ static SILValue emitConstructorMetatypeArg(SILGenFunction &SGF,
3131
ValueDecl *ctor) {
3232
// In addition to the declared arguments, the constructor implicitly takes
3333
// the metatype as its first argument, like a static function.
34-
Type metatype = ctor->getInterfaceType()->castTo<AnyFunctionType>()->getInput();
34+
auto ctorFnType = ctor->getInterfaceType()->castTo<AnyFunctionType>();
35+
assert(ctorFnType->getParams().size() == 1 &&
36+
"more than one self parameter?");
37+
Type metatype = ctorFnType->getParams()[0].getType();
3538
auto *DC = ctor->getInnermostDeclContext();
3639
auto &AC = SGF.getASTContext();
3740
auto VD =

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,18 @@ static std::pair<unsigned, unsigned> getTypeDepthAndWidth(Type t) {
150150
if (auto *FnTy = t->getAs<FunctionType>()) {
151151
Depth++;
152152
unsigned MaxTypeDepth = 0;
153+
auto Params = FnTy->getParams();
154+
Width += Params.size();
155+
for (auto &Param : Params) {
156+
unsigned TypeWidth;
157+
unsigned TypeDepth;
158+
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(Param.getType());
159+
if (TypeDepth > MaxTypeDepth)
160+
MaxTypeDepth = TypeDepth;
161+
Width += TypeWidth;
162+
}
153163
unsigned TypeWidth;
154164
unsigned TypeDepth;
155-
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(FnTy->getInput());
156-
if (TypeDepth > MaxTypeDepth)
157-
MaxTypeDepth = TypeDepth;
158-
Width += TypeWidth;
159165
std::tie(TypeDepth, TypeWidth) = getTypeDepthAndWidth(FnTy->getResult());
160166
if (TypeDepth > MaxTypeDepth)
161167
MaxTypeDepth = TypeDepth;

0 commit comments

Comments
 (0)