mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Handle explicit lifetime dependence specifiers in initializers
This commit is contained in:
@@ -3577,6 +3577,8 @@ TypeRepr *ValueDecl::getResultTypeRepr() const {
|
||||
returnRepr = SD->getElementTypeRepr();
|
||||
} else if (auto *MD = dyn_cast<MacroDecl>(this)) {
|
||||
returnRepr = MD->resultType.getTypeRepr();
|
||||
} else if (auto *CD = dyn_cast<ConstructorDecl>(this)) {
|
||||
returnRepr = CD->getResultTypeRepr();
|
||||
}
|
||||
|
||||
return returnRepr;
|
||||
@@ -10383,7 +10385,7 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
|
||||
TypeLoc ThrownType,
|
||||
ParameterList *BodyParams,
|
||||
GenericParamList *GenericParams,
|
||||
DeclContext *Parent)
|
||||
DeclContext *Parent, TypeRepr *ResultTyR)
|
||||
: AbstractFunctionDecl(DeclKind::Constructor, Parent, Name, ConstructorLoc,
|
||||
Async, AsyncLoc, Throws, ThrowsLoc, ThrownType,
|
||||
/*HasImplicitSelfDecl=*/true,
|
||||
@@ -10393,7 +10395,8 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
|
||||
{
|
||||
if (BodyParams)
|
||||
setParameters(BodyParams);
|
||||
|
||||
|
||||
InitRetType = TypeLoc(ResultTyR);
|
||||
Bits.ConstructorDecl.HasStubImplementation = 0;
|
||||
Bits.ConstructorDecl.Failable = Failable;
|
||||
|
||||
@@ -10414,7 +10417,8 @@ ConstructorDecl *ConstructorDecl::createImported(
|
||||
failable, failabilityLoc,
|
||||
async, asyncLoc,
|
||||
throws, throwsLoc, TypeLoc::withoutLoc(thrownType),
|
||||
bodyParams, genericParams, parent);
|
||||
bodyParams, genericParams, parent,
|
||||
/*LifetimeDependenceTypeRepr*/ nullptr);
|
||||
ctor->setClangNode(clangNode);
|
||||
return ctor;
|
||||
}
|
||||
@@ -10432,6 +10436,10 @@ bool ConstructorDecl::isObjCZeroParameterWithLongSelector() const {
|
||||
return params->get(0)->getInterfaceType()->isVoid();
|
||||
}
|
||||
|
||||
bool ConstructorDecl::hasLifetimeDependentReturn() const {
|
||||
return isa_and_nonnull<LifetimeDependentReturnTypeRepr>(getResultTypeRepr());
|
||||
}
|
||||
|
||||
DestructorDecl::DestructorDecl(SourceLoc DestructorLoc, DeclContext *Parent)
|
||||
: AbstractFunctionDecl(DeclKind::Destructor, Parent,
|
||||
DeclBaseName::createDestructor(), DestructorLoc,
|
||||
|
||||
Reference in New Issue
Block a user