@@ -43,13 +43,12 @@ enum class ParsedLifetimeDependenceKind : uint8_t {
43
43
44
44
enum class LifetimeDependenceKind : uint8_t { Inherit = 0 , Scope };
45
45
46
- class LifetimeDependenceSpecifier {
47
- public:
48
- enum class SpecifierKind { Named, Ordered, Self, Immortal };
46
+ enum class LifetimeSpecifierKind { Named, Ordered, Self, Immortal };
49
47
48
+ class LifetimeDependenceSpecifier {
50
49
private:
51
50
SourceLoc loc;
52
- SpecifierKind specifierKind;
51
+ LifetimeSpecifierKind specifierKind;
53
52
ParsedLifetimeDependenceKind parsedLifetimeDependenceKind;
54
53
union Value {
55
54
struct {
@@ -66,7 +65,7 @@ class LifetimeDependenceSpecifier {
66
65
} value;
67
66
68
67
LifetimeDependenceSpecifier (
69
- SourceLoc loc, SpecifierKind specifierKind,
68
+ SourceLoc loc, LifetimeSpecifierKind specifierKind,
70
69
ParsedLifetimeDependenceKind parsedLifetimeDependenceKind, Value value)
71
70
: loc(loc), specifierKind(specifierKind),
72
71
parsedLifetimeDependenceKind (parsedLifetimeDependenceKind),
@@ -82,7 +81,7 @@ class LifetimeDependenceSpecifier {
82
81
83
82
static LifetimeDependenceSpecifier
84
83
getImmortalLifetimeDependenceSpecifier (SourceLoc loc) {
85
- return {loc, SpecifierKind ::Immortal, {}, {}};
84
+ return {loc, LifetimeSpecifierKind ::Immortal, {}, {}};
86
85
}
87
86
88
87
static LifetimeDependenceSpecifier getOrderedLifetimeDependenceSpecifier (
@@ -100,34 +99,34 @@ class LifetimeDependenceSpecifier {
100
99
101
100
SourceLoc getLoc () const { return loc; }
102
101
103
- SpecifierKind getSpecifierKind () const { return specifierKind; }
102
+ LifetimeSpecifierKind getSpecifierKind () const { return specifierKind; }
104
103
105
104
ParsedLifetimeDependenceKind getParsedLifetimeDependenceKind () const {
106
105
return parsedLifetimeDependenceKind;
107
106
}
108
107
109
108
Identifier getName () const {
110
- assert (specifierKind == SpecifierKind ::Named);
109
+ assert (specifierKind == LifetimeSpecifierKind ::Named);
111
110
return value.Named .name ;
112
111
}
113
112
114
113
unsigned getIndex () const {
115
- assert (specifierKind == SpecifierKind ::Ordered);
114
+ assert (specifierKind == LifetimeSpecifierKind ::Ordered);
116
115
return value.Ordered .index ;
117
116
}
118
117
119
118
std::string getParamString () const {
120
119
switch (specifierKind) {
121
- case SpecifierKind ::Named:
120
+ case LifetimeSpecifierKind ::Named:
122
121
return value.Named .name .str ().str ();
123
- case SpecifierKind ::Self:
122
+ case LifetimeSpecifierKind ::Self:
124
123
return " self" ;
125
- case SpecifierKind ::Ordered:
124
+ case LifetimeSpecifierKind ::Ordered:
126
125
return std::to_string (value.Ordered .index );
127
- case SpecifierKind ::Immortal:
126
+ case LifetimeSpecifierKind ::Immortal:
128
127
return " immortal" ;
129
128
}
130
- llvm_unreachable (" Invalid LifetimeDependenceSpecifier::SpecifierKind " );
129
+ llvm_unreachable (" Invalid LifetimeSpecifierKind " );
131
130
}
132
131
133
132
std::string getLifetimeDependenceSpecifierString () const {
@@ -155,10 +154,10 @@ class LifetimeDependenceInfo {
155
154
unsigned sourceIndex,
156
155
LifetimeDependenceKind kind);
157
156
158
- // / Builds LifetimeDependenceInfo on a result or parameter from a swift decl
157
+ // / Builds LifetimeDependenceInfo from dependsOn type modifier
159
158
static std::optional<LifetimeDependenceInfo>
160
- fromTypeRepr (AbstractFunctionDecl *afd, LifetimeDependentTypeRepr *typeRepr ,
161
- unsigned targetIndex);
159
+ fromDependsOn (AbstractFunctionDecl *afd, TypeRepr *targetRepr ,
160
+ Type targetType, unsigned targetIndex);
162
161
163
162
// / Infer LifetimeDependenceInfo on result
164
163
static std::optional<LifetimeDependenceInfo> infer (AbstractFunctionDecl *afd);
@@ -173,9 +172,9 @@ class LifetimeDependenceInfo {
173
172
174
173
// / Builds LifetimeDependenceInfo from SIL function type
175
174
static std::optional<LifetimeDependenceInfo>
176
- fromTypeRepr (LifetimeDependentTypeRepr *lifetimeDependentRepr,
177
- unsigned targetIndex, ArrayRef<SILParameterInfo> params,
178
- DeclContext *dc);
175
+ fromDependsOn (LifetimeDependentTypeRepr *lifetimeDependentRepr,
176
+ unsigned targetIndex, ArrayRef<SILParameterInfo> params,
177
+ DeclContext *dc);
179
178
180
179
public:
181
180
LifetimeDependenceInfo (IndexSubset *inheritLifetimeParamIndices,
0 commit comments