Skip to content

Commit 1e8dc55

Browse files
committed
[AST] NFC: Remove InitRetType
This is no longer used.
1 parent 34cc3e8 commit 1e8dc55

11 files changed

+17
-52
lines changed

include/swift/AST/Decl.h

+1-10
Original file line numberDiff line numberDiff line change
@@ -8369,8 +8369,6 @@ class FuncDecl : public AbstractFunctionDecl {
83698369

83708370
TypeRepr *getResultTypeRepr() const { return FnRetType.getTypeRepr(); }
83718371

8372-
void setDeserializedResultTypeLoc(TypeLoc ResultTyR);
8373-
83748372
SourceRange getResultTypeSourceRange() const {
83758373
return FnRetType.getSourceRange();
83768374
}
@@ -8897,9 +8895,6 @@ class ConstructorDecl : public AbstractFunctionDecl {
88978895
/// inserted at the end of the initializer by SILGen.
88988896
Expr *CallToSuperInit = nullptr;
88998897

8900-
/// Valid when lifetime dependence specifiers are present.
8901-
TypeLoc InitRetType;
8902-
89038898
public:
89048899
ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
89058900
bool Failable, SourceLoc FailabilityLoc,
@@ -8908,7 +8903,7 @@ class ConstructorDecl : public AbstractFunctionDecl {
89088903
TypeLoc thrownTy,
89098904
ParameterList *BodyParams,
89108905
GenericParamList *GenericParams,
8911-
DeclContext *Parent, TypeRepr *InitRetTy);
8906+
DeclContext *Parent);
89128907

89138908
static ConstructorDecl *
89148909
createImported(ASTContext &ctx, ClangNode clangNode, DeclName name,
@@ -8930,10 +8925,6 @@ class ConstructorDecl : public AbstractFunctionDecl {
89308925
/// Get the interface type of the initializing constructor.
89318926
Type getInitializerInterfaceType();
89328927

8933-
TypeRepr *getResultTypeRepr() const { return InitRetType.getTypeRepr(); }
8934-
8935-
void setDeserializedResultTypeLoc(TypeLoc ResultTyR);
8936-
89378928
/// Get the typechecked call to super.init expression, which needs to be
89388929
/// inserted at the end of the initializer by SILGen.
89398930
Expr *getSuperInitCall() { return CallToSuperInit; }

lib/AST/Bridging/DeclBridging.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,11 @@ BridgedConstructorDecl BridgedConstructorDecl_createParsed(
290290
auto throwsLoc = cThrowsLoc.unbridged();
291291
auto failabilityMarkLoc = cFailabilityMarkLoc.unbridged();
292292
// FIXME: rethrows
293-
// TODO: Handle LifetimeDependentReturnTypeRepr here.
294293
auto *decl = new (context) ConstructorDecl(
295294
declName, cInitKeywordLoc.unbridged(), failabilityMarkLoc.isValid(),
296295
failabilityMarkLoc, asyncLoc.isValid(), asyncLoc, throwsLoc.isValid(),
297296
throwsLoc, thrownType.unbridged(), parameterList,
298-
genericParams.unbridged(), cDeclContext.unbridged(),
299-
/*InitRetTy*/ nullptr);
297+
genericParams.unbridged(), cDeclContext.unbridged());
300298
decl->setTrailingWhereClause(genericWhereClause.unbridged());
301299
decl->setImplicitlyUnwrappedOptional(isIUO);
302300

lib/AST/Decl.cpp

+2-14
Original file line numberDiff line numberDiff line change
@@ -3994,8 +3994,6 @@ TypeRepr *ValueDecl::getResultTypeRepr() const {
39943994
returnRepr = SD->getElementTypeRepr();
39953995
} else if (auto *MD = dyn_cast<MacroDecl>(this)) {
39963996
returnRepr = MD->resultType.getTypeRepr();
3997-
} else if (auto *CD = dyn_cast<ConstructorDecl>(this)) {
3998-
returnRepr = CD->getResultTypeRepr();
39993997
}
40003998

40013999
return returnRepr;
@@ -10500,10 +10498,6 @@ void FuncDecl::setResultInterfaceType(Type type) {
1050010498
std::move(type));
1050110499
}
1050210500

10503-
void FuncDecl::setDeserializedResultTypeLoc(TypeLoc ResultTyR) {
10504-
FnRetType = ResultTyR;
10505-
}
10506-
1050710501
FuncDecl *FuncDecl::createImpl(ASTContext &Context,
1050810502
SourceLoc StaticLoc,
1050910503
StaticSpellingKind StaticSpelling,
@@ -10941,7 +10935,7 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
1094110935
TypeLoc ThrownType,
1094210936
ParameterList *BodyParams,
1094310937
GenericParamList *GenericParams,
10944-
DeclContext *Parent, TypeRepr *ResultTyR)
10938+
DeclContext *Parent)
1094510939
: AbstractFunctionDecl(DeclKind::Constructor, Parent, Name, ConstructorLoc,
1094610940
Async, AsyncLoc, Throws, ThrowsLoc, ThrownType,
1094710941
/*HasImplicitSelfDecl=*/true,
@@ -10952,7 +10946,6 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
1095210946
if (BodyParams)
1095310947
setParameters(BodyParams);
1095410948

10955-
InitRetType = TypeLoc(ResultTyR);
1095610949
Bits.ConstructorDecl.HasStubImplementation = 0;
1095710950
Bits.ConstructorDecl.Failable = Failable;
1095810951

@@ -10973,16 +10966,11 @@ ConstructorDecl *ConstructorDecl::createImported(
1097310966
failable, failabilityLoc,
1097410967
async, asyncLoc,
1097510968
throws, throwsLoc, TypeLoc::withoutLoc(thrownType),
10976-
bodyParams, genericParams, parent,
10977-
/*LifetimeDependenceTypeRepr*/ nullptr);
10969+
bodyParams, genericParams, parent);
1097810970
ctor->setClangNode(clangNode);
1097910971
return ctor;
1098010972
}
1098110973

10982-
void ConstructorDecl::setDeserializedResultTypeLoc(TypeLoc ResultTyR) {
10983-
InitRetType = ResultTyR;
10984-
}
10985-
1098610974
bool ConstructorDecl::isObjCZeroParameterWithLongSelector() const {
1098710975
// The initializer must have a single, non-empty argument name.
1098810976
if (getName().getArgumentNames().size() != 1 ||

lib/ClangImporter/ImportDecl.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -3922,8 +3922,7 @@ namespace {
39223922
/*failable=*/false, /*FailabilityLoc=*/SourceLoc(),
39233923
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
39243924
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
3925-
/*ThrownType=*/TypeLoc(), bodyParams, genericParams, dc,
3926-
/*LifetimeDependentTypeRepr*/ nullptr);
3925+
/*ThrownType=*/TypeLoc(), bodyParams, genericParams, dc);
39273926
} else {
39283927
auto resultTy = importedType.getType();
39293928

@@ -6734,8 +6733,7 @@ Decl *SwiftDeclConverter::importGlobalAsInitializer(
67346733
/*FailabilityLoc=*/SourceLoc(),
67356734
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
67366735
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(),
6737-
parameterList, /*GenericParams=*/nullptr, dc,
6738-
/*LifetimeDependentTypeRepr*/ nullptr);
6736+
parameterList, /*GenericParams=*/nullptr, dc);
67396737
result->setImplicitlyUnwrappedOptional(isIUO);
67406738
result->getASTContext().evaluator.cacheOutput(InitKindRequest{result},
67416739
std::move(initKind));
@@ -7262,8 +7260,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
72627260
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
72637261
/*Throws=*/importedName.getErrorInfo().has_value(),
72647262
/*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), bodyParams,
7265-
/*GenericParams=*/nullptr, const_cast<DeclContext *>(dc),
7266-
/*LifetimeDependentTypeRepr*/ nullptr);
7263+
/*GenericParams=*/nullptr, const_cast<DeclContext *>(dc));
72677264

72687265
addObjCAttribute(result, selector);
72697266
recordMemberInContext(dc, result);

lib/ClangImporter/SwiftDeclSynthesizer.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,7 @@ SwiftDeclSynthesizer::createDefaultConstructor(NominalTypeDecl *structDecl) {
507507
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
508508
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
509509
/*ThrownType=*/TypeLoc(), emptyPL,
510-
/*GenericParams=*/nullptr, structDecl,
511-
/*LifetimeDependentTypeRepr*/ nullptr);
510+
/*GenericParams=*/nullptr, structDecl);
512511

513512
constructor->copyFormalAccessFrom(structDecl);
514513

@@ -638,8 +637,7 @@ ConstructorDecl *SwiftDeclSynthesizer::createValueConstructor(
638637
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
639638
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
640639
/*ThrownType=*/TypeLoc(), paramList,
641-
/*GenericParams=*/nullptr, structDecl,
642-
/*LifetimeDependentTypeRepr*/ nullptr);
640+
/*GenericParams=*/nullptr, structDecl);
643641

644642
constructor->copyFormalAccessFrom(structDecl);
645643

@@ -1286,8 +1284,7 @@ SwiftDeclSynthesizer::makeEnumRawValueConstructor(EnumDecl *enumDecl) {
12861284
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
12871285
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
12881286
/*ThrownType=*/TypeLoc(), paramPL,
1289-
/*GenericParams=*/nullptr, enumDecl,
1290-
/*LifetimeDependentTypeRepr*/ nullptr);
1287+
/*GenericParams=*/nullptr, enumDecl);
12911288
ctorDecl->setImplicit();
12921289
ctorDecl->copyFormalAccessFrom(enumDecl);
12931290
ctorDecl->setBodySynthesizer(synthesizeEnumRawValueConstructorBody, enumDecl);

lib/Parse/ParseDecl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9849,7 +9849,7 @@ Parser::parseDeclInit(ParseDeclOptions Flags, DeclAttributes &Attributes) {
98499849
isAsync, asyncLoc,
98509850
throwsLoc.isValid(), throwsLoc,
98519851
thrownTy, BodyParams, GenericParams,
9852-
CurDeclContext, FuncRetTy);
9852+
CurDeclContext);
98539853
CD->setImplicitlyUnwrappedOptional(IUO);
98549854
CD->attachParsedAttrs(Attributes);
98559855

lib/Sema/CodeSynthesis.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ static ConstructorDecl *createImplicitConstructor(NominalTypeDecl *decl,
332332
/*Failable=*/false, /*FailabilityLoc=*/SourceLoc(),
333333
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
334334
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
335-
/*ThrownType=*/TypeLoc(), paramList, /*GenericParams=*/nullptr, decl,
336-
/*LifetimeDependentTypeRepr*/ nullptr);
335+
/*ThrownType=*/TypeLoc(), paramList, /*GenericParams=*/nullptr, decl);
337336

338337
// Mark implicit.
339338
ctor->setImplicit();
@@ -827,8 +826,7 @@ createDesignatedInitOverride(ClassDecl *classDecl,
827826
/*AsyncLoc=*/SourceLoc(),
828827
/*Throws=*/superclassCtor->hasThrows(),
829828
/*ThrowsLoc=*/SourceLoc(), TypeLoc::withoutLoc(thrownType), bodyParams,
830-
genericParams, implCtx->getAsGenericContext(),
831-
/*LifetimeDependentTypeRepr*/ nullptr);
829+
genericParams, implCtx->getAsGenericContext());
832830

833831
ctor->setImplicit();
834832

lib/Sema/DerivedConformanceCodable.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1889,8 +1889,7 @@ static ValueDecl *deriveDecodable_init(DerivedConformance &derived) {
18891889
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
18901890
/*Throws=*/true, SourceLoc(),
18911891
/*ThrownType=*/TypeLoc(), paramList,
1892-
/*GenericParams=*/nullptr, conformanceDC,
1893-
/*LifetimeDependentTypeRepr*/ nullptr);
1892+
/*GenericParams=*/nullptr, conformanceDC);
18941893
initDecl->setImplicit();
18951894
initDecl->setSynthesized();
18961895

lib/Sema/DerivedConformanceCodingKey.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ static ValueDecl *deriveInitDecl(DerivedConformance &derived, Type paramType,
132132
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
133133
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
134134
/*ThrownType=*/TypeLoc(), paramList,
135-
/*GenericParams=*/nullptr, parentDC,
136-
/*LifetimeDependentTypeRepr*/ nullptr);
135+
/*GenericParams=*/nullptr, parentDC);
137136

138137
initDecl->setImplicit();
139138

lib/Sema/DerivedConformanceRawRepresentable.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,7 @@ deriveRawRepresentable_init(DerivedConformance &derived) {
430430
/*Async=*/false, /*AsyncLoc=*/SourceLoc(),
431431
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
432432
/*ThrownType=*/TypeLoc(), paramList,
433-
/*GenericParams=*/nullptr, parentDC,
434-
/*LifetimeDependentTypeRepr*/ nullptr);
433+
/*GenericParams=*/nullptr, parentDC);
435434

436435
initDecl->setImplicit();
437436
initDecl->setBodySynthesizer(&deriveBodyRawRepresentable_init);

lib/Serialization/Deserialization.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -3717,8 +3717,7 @@ class DeclDeserializer {
37173717
/*ThrowsLoc=*/SourceLoc(),
37183718
TypeLoc::withoutLoc(thrownType),
37193719
/*BodyParams=*/nullptr,
3720-
genericParams, parent,
3721-
nullptr);
3720+
genericParams, parent);
37223721
declOrOffset = ctor;
37233722

37243723
ctor->setGenericSignature(MF.getGenericSignature(genericSigID));

0 commit comments

Comments
 (0)