mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #82354 from meg-gupta/lifetimeenum
Add lifetime dependencies on function types representing ~Escapable enum elements with ~Escapable payloads
This commit is contained in:
@@ -8779,7 +8779,8 @@ public:
|
||||
/// EnumCaseDecl.
|
||||
class EnumElementDecl : public DeclContext, public ValueDecl {
|
||||
friend class EnumRawValuesRequest;
|
||||
|
||||
friend class LifetimeDependenceInfoRequest;
|
||||
|
||||
/// This is the type specified with the enum element, for
|
||||
/// example 'Int' in 'case Y(Int)'. This is null if there is no type
|
||||
/// associated with this element, as in 'case Z' or in all elements of enum
|
||||
@@ -8791,6 +8792,11 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
|
||||
/// The raw value literal for the enum element, or null.
|
||||
LiteralExpr *RawValueExpr;
|
||||
|
||||
protected:
|
||||
struct {
|
||||
unsigned NoLifetimeDependenceInfo : 1;
|
||||
} LazySemanticInfo = {};
|
||||
|
||||
public:
|
||||
EnumElementDecl(SourceLoc IdentifierLoc, DeclName Name,
|
||||
ParameterList *Params,
|
||||
|
||||
@@ -324,8 +324,7 @@ public:
|
||||
/// Builds LifetimeDependenceInfo from a swift decl, either from the explicit
|
||||
/// lifetime dependence specifiers or by inference based on types and
|
||||
/// ownership modifiers.
|
||||
static std::optional<ArrayRef<LifetimeDependenceInfo>>
|
||||
get(AbstractFunctionDecl *decl);
|
||||
static std::optional<ArrayRef<LifetimeDependenceInfo>> get(ValueDecl *decl);
|
||||
|
||||
/// Builds LifetimeDependenceInfo from SIL
|
||||
static std::optional<llvm::ArrayRef<LifetimeDependenceInfo>>
|
||||
|
||||
@@ -5114,8 +5114,7 @@ public:
|
||||
class LifetimeDependenceInfoRequest
|
||||
: public SimpleRequest<
|
||||
LifetimeDependenceInfoRequest,
|
||||
std::optional<llvm::ArrayRef<LifetimeDependenceInfo>>(
|
||||
AbstractFunctionDecl *),
|
||||
std::optional<llvm::ArrayRef<LifetimeDependenceInfo>>(ValueDecl *),
|
||||
RequestFlags::SeparatelyCached | RequestFlags::SplitCached> {
|
||||
public:
|
||||
using SimpleRequest::SimpleRequest;
|
||||
@@ -5124,7 +5123,7 @@ private:
|
||||
friend SimpleRequest;
|
||||
|
||||
std::optional<llvm::ArrayRef<LifetimeDependenceInfo>>
|
||||
evaluate(Evaluator &evaluator, AbstractFunctionDecl *AFD) const;
|
||||
evaluate(Evaluator &evaluator, ValueDecl *AFD) const;
|
||||
|
||||
public:
|
||||
// Separate caching.
|
||||
|
||||
Reference in New Issue
Block a user