@@ -27,14 +27,14 @@ namespace {
27
27
// / A result plan for evaluating an indirect result into the address
28
28
// / associated with an initialization.
29
29
class InPlaceInitializationResultPlan : public ResultPlan {
30
- Initialization *Init ;
30
+ Initialization *init ;
31
31
32
32
public:
33
- InPlaceInitializationResultPlan (Initialization *init) : Init (init) {}
33
+ InPlaceInitializationResultPlan (Initialization *init) : init (init) {}
34
34
35
35
RValue finish (SILGenFunction &SGF, SILLocation loc, CanType substType,
36
36
ArrayRef<ManagedValue> &directResults) override {
37
- Init ->finishInitialization (SGF);
37
+ init ->finishInitialization (SGF);
38
38
return RValue ();
39
39
}
40
40
};
@@ -43,17 +43,17 @@ class InPlaceInitializationResultPlan : public ResultPlan {
43
43
// / reabstracting it. The value can actually be a tuple if the
44
44
// / abstraction is opaque.
45
45
class ScalarResultPlan : public ResultPlan {
46
- std::unique_ptr<TemporaryInitialization> Temporary ;
47
- AbstractionPattern OrigType ;
48
- Initialization *Init ;
49
- SILFunctionTypeRepresentation Rep ;
46
+ std::unique_ptr<TemporaryInitialization> temporary ;
47
+ AbstractionPattern origType ;
48
+ Initialization *init ;
49
+ SILFunctionTypeRepresentation rep ;
50
50
51
51
public:
52
52
ScalarResultPlan (std::unique_ptr<TemporaryInitialization> &&temporary,
53
53
AbstractionPattern origType, Initialization *init,
54
54
SILFunctionTypeRepresentation rep)
55
- : Temporary (std::move(temporary)), OrigType (origType), Init (init),
56
- Rep (rep) {}
55
+ : temporary (std::move(temporary)), origType (origType), init (init),
56
+ rep (rep) {}
57
57
58
58
RValue finish (SILGenFunction &SGF, SILLocation loc, CanType substType,
59
59
ArrayRef<ManagedValue> &directResults) override {
@@ -65,10 +65,10 @@ class ScalarResultPlan : public ResultPlan {
65
65
66
66
// If we were created with a temporary, that address was passed as
67
67
// an indirect result.
68
- if (Temporary ) {
68
+ if (temporary ) {
69
69
// Establish the cleanup.
70
- Temporary ->finishInitialization (SGF);
71
- value = Temporary ->getManagedAddress ();
70
+ temporary ->finishInitialization (SGF);
71
+ value = temporary ->getManagedAddress ();
72
72
73
73
// If the value isn't address-only, go ahead and load.
74
74
if (!substTL.isAddressOnly ()) {
@@ -85,17 +85,17 @@ class ScalarResultPlan : public ResultPlan {
85
85
86
86
// Reabstract the value if the types don't match. This can happen
87
87
// due to either substitution reabstractions or bridging.
88
- if (value.getType ().hasAbstractionDifference (Rep ,
88
+ if (value.getType ().hasAbstractionDifference (rep ,
89
89
substTL.getLoweredType ())) {
90
90
// Assume that a C-language API doesn't have substitution
91
91
// reabstractions. This shouldn't be necessary, but
92
92
// emitOrigToSubstValue can get upset.
93
- if (getSILFunctionLanguage (Rep ) == SILFunctionLanguage::C) {
94
- value = SGF.emitBridgedToNativeValue (loc, value, Rep , substType);
93
+ if (getSILFunctionLanguage (rep ) == SILFunctionLanguage::C) {
94
+ value = SGF.emitBridgedToNativeValue (loc, value, rep , substType);
95
95
96
96
} else {
97
- value = SGF.emitOrigToSubstValue (loc, value, OrigType , substType,
98
- SGFContext (Init ));
97
+ value = SGF.emitOrigToSubstValue (loc, value, origType , substType,
98
+ SGFContext (init ));
99
99
100
100
// If that successfully emitted into the initialization, we're done.
101
101
if (value.isInContext ())
@@ -104,9 +104,9 @@ class ScalarResultPlan : public ResultPlan {
104
104
}
105
105
106
106
// Otherwise, forcibly emit into the initialization if it exists.
107
- if (Init ) {
108
- Init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
109
- Init ->finishInitialization (SGF);
107
+ if (init ) {
108
+ init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
109
+ init ->finishInitialization (SGF);
110
110
return RValue ();
111
111
112
112
// Otherwise, we've got the r-value we want.
@@ -119,26 +119,26 @@ class ScalarResultPlan : public ResultPlan {
119
119
// / A result plan which calls copyOrInitValueInto on an Initialization
120
120
// / using a temporary buffer initialized by a sub-plan.
121
121
class InitValueFromTemporaryResultPlan : public ResultPlan {
122
- Initialization *Init ;
123
- ResultPlanPtr SubPlan ;
124
- std::unique_ptr<TemporaryInitialization> Temporary ;
122
+ Initialization *init ;
123
+ ResultPlanPtr subPlan ;
124
+ std::unique_ptr<TemporaryInitialization> temporary ;
125
125
126
126
public:
127
127
InitValueFromTemporaryResultPlan (
128
128
Initialization *init, ResultPlanPtr &&subPlan,
129
129
std::unique_ptr<TemporaryInitialization> &&temporary)
130
- : Init (init), SubPlan (std::move(subPlan)),
131
- Temporary (std::move(temporary)) {}
130
+ : init (init), subPlan (std::move(subPlan)),
131
+ temporary (std::move(temporary)) {}
132
132
133
133
RValue finish (SILGenFunction &SGF, SILLocation loc, CanType substType,
134
134
ArrayRef<ManagedValue> &directResults) override {
135
- RValue subResult = SubPlan ->finish (SGF, loc, substType, directResults);
135
+ RValue subResult = subPlan ->finish (SGF, loc, substType, directResults);
136
136
assert (subResult.isUsed () && " sub-plan didn't emit into context?" );
137
137
(void )subResult;
138
138
139
- ManagedValue value = Temporary ->getManagedAddress ();
140
- Init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
141
- Init ->finishInitialization (SGF);
139
+ ManagedValue value = temporary ->getManagedAddress ();
140
+ init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
141
+ init ->finishInitialization (SGF);
142
142
143
143
return RValue ();
144
144
}
@@ -147,20 +147,20 @@ class InitValueFromTemporaryResultPlan : public ResultPlan {
147
147
// / A result plan which calls copyOrInitValueInto using the result of
148
148
// / a sub-plan.
149
149
class InitValueFromRValueResultPlan : public ResultPlan {
150
- Initialization *Init ;
151
- ResultPlanPtr SubPlan ;
150
+ Initialization *init ;
151
+ ResultPlanPtr subPlan ;
152
152
153
153
public:
154
154
InitValueFromRValueResultPlan (Initialization *init, ResultPlanPtr &&subPlan)
155
- : Init (init), SubPlan (std::move(subPlan)) {}
155
+ : init (init), subPlan (std::move(subPlan)) {}
156
156
157
157
RValue finish (SILGenFunction &SGF, SILLocation loc, CanType substType,
158
158
ArrayRef<ManagedValue> &directResults) override {
159
- RValue subResult = SubPlan ->finish (SGF, loc, substType, directResults);
159
+ RValue subResult = subPlan ->finish (SGF, loc, substType, directResults);
160
160
ManagedValue value = std::move (subResult).getAsSingleValue (SGF, loc);
161
161
162
- Init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
163
- Init ->finishInitialization (SGF);
162
+ init ->copyOrInitValueInto (SGF, loc, value, /* init*/ true );
163
+ init ->finishInitialization (SGF);
164
164
165
165
return RValue ();
166
166
}
@@ -169,17 +169,17 @@ class InitValueFromRValueResultPlan : public ResultPlan {
169
169
// / A result plan which produces a larger RValue from a bunch of
170
170
// / components.
171
171
class TupleRValueResultPlan : public ResultPlan {
172
- SmallVector<ResultPlanPtr, 4 > EltPlans ;
172
+ SmallVector<ResultPlanPtr, 4 > eltPlans ;
173
173
174
174
public:
175
175
TupleRValueResultPlan (ResultPlanBuilder &builder, AbstractionPattern origType,
176
176
CanTupleType substType) {
177
177
// Create plans for all the elements.
178
- EltPlans .reserve (substType->getNumElements ());
178
+ eltPlans .reserve (substType->getNumElements ());
179
179
for (auto i : indices (substType->getElementTypes ())) {
180
180
AbstractionPattern origEltType = origType.getTupleElementType (i);
181
181
CanType substEltType = substType.getElementType (i);
182
- EltPlans .push_back (builder.build (nullptr , origEltType, substEltType));
182
+ eltPlans .push_back (builder.build (nullptr , origEltType, substEltType));
183
183
}
184
184
}
185
185
@@ -189,9 +189,9 @@ class TupleRValueResultPlan : public ResultPlan {
189
189
190
190
// Finish all the component tuples.
191
191
auto substTupleType = cast<TupleType>(substType);
192
- assert (substTupleType.getElementTypes ().size () == EltPlans .size ());
192
+ assert (substTupleType.getElementTypes ().size () == eltPlans .size ());
193
193
for (auto i : indices (substTupleType.getElementTypes ())) {
194
- RValue eltRV = EltPlans [i]->finish (
194
+ RValue eltRV = eltPlans [i]->finish (
195
195
SGF, loc, substTupleType.getElementType (i), directResults);
196
196
tupleRV.addElement (std::move (eltRV));
197
197
}
@@ -203,43 +203,43 @@ class TupleRValueResultPlan : public ResultPlan {
203
203
// / A result plan which evaluates into the sub-components
204
204
// / of a splittable tuple initialization.
205
205
class TupleInitializationResultPlan : public ResultPlan {
206
- Initialization *TupleInit ;
207
- SmallVector<InitializationPtr, 4 > EltInitsBuffer ;
208
- MutableArrayRef<InitializationPtr> EltInits ;
209
- SmallVector<ResultPlanPtr, 4 > EltPlans ;
206
+ Initialization *tupleInit ;
207
+ SmallVector<InitializationPtr, 4 > eltInitsBuffer ;
208
+ MutableArrayRef<InitializationPtr> eltInits ;
209
+ SmallVector<ResultPlanPtr, 4 > eltPlans ;
210
210
211
211
public:
212
212
TupleInitializationResultPlan (ResultPlanBuilder &builder,
213
213
Initialization *tupleInit,
214
214
AbstractionPattern origType,
215
215
CanTupleType substType)
216
- : TupleInit (tupleInit) {
216
+ : tupleInit (tupleInit) {
217
217
218
218
// Get the sub-initializations.
219
- EltInits = tupleInit->splitIntoTupleElements (builder.SGF , builder.Loc ,
220
- substType, EltInitsBuffer );
219
+ eltInits = tupleInit->splitIntoTupleElements (builder.SGF , builder.loc ,
220
+ substType, eltInitsBuffer );
221
221
222
222
// Create plans for all the sub-initializations.
223
- EltPlans .reserve (substType->getNumElements ());
223
+ eltPlans .reserve (substType->getNumElements ());
224
224
for (auto i : indices (substType->getElementTypes ())) {
225
225
AbstractionPattern origEltType = origType.getTupleElementType (i);
226
226
CanType substEltType = substType.getElementType (i);
227
- Initialization *eltInit = EltInits [i].get ();
228
- EltPlans .push_back (builder.build (eltInit, origEltType, substEltType));
227
+ Initialization *eltInit = eltInits [i].get ();
228
+ eltPlans .push_back (builder.build (eltInit, origEltType, substEltType));
229
229
}
230
230
}
231
231
232
232
RValue finish (SILGenFunction &SGF, SILLocation loc, CanType substType,
233
233
ArrayRef<ManagedValue> &directResults) override {
234
234
auto substTupleType = cast<TupleType>(substType);
235
- assert (substTupleType.getElementTypes ().size () == EltPlans .size ());
235
+ assert (substTupleType.getElementTypes ().size () == eltPlans .size ());
236
236
for (auto i : indices (substTupleType.getElementTypes ())) {
237
237
auto eltType = substTupleType.getElementType (i);
238
- RValue eltRV = EltPlans [i]->finish (SGF, loc, eltType, directResults);
238
+ RValue eltRV = eltPlans [i]->finish (SGF, loc, eltType, directResults);
239
239
assert (eltRV.isUsed ());
240
240
(void )eltRV;
241
241
}
242
- TupleInit ->finishInitialization (SGF);
242
+ tupleInit ->finishInitialization (SGF);
243
243
244
244
return RValue ();
245
245
}
@@ -263,8 +263,8 @@ ResultPlanPtr ResultPlanBuilder::build(Initialization *init,
263
263
}
264
264
265
265
// Otherwise, grab the next result.
266
- auto result = AllResults .front ();
267
- AllResults = AllResults .slice (1 );
266
+ auto result = allResults .front ();
267
+ allResults = allResults .slice (1 );
268
268
269
269
SILValue initAddr;
270
270
if (init) {
@@ -274,8 +274,8 @@ ResultPlanPtr ResultPlanBuilder::build(Initialization *init,
274
274
// there are no abstraction differences, then just do it.
275
275
if (initAddr && SGF.silConv .isSILIndirect (result) &&
276
276
!initAddr->getType ().hasAbstractionDifference (
277
- Rep , result.getSILStorageType ())) {
278
- IndirectResultAddrs .push_back (initAddr);
277
+ rep , result.getSILStorageType ())) {
278
+ indirectResultAddrs .push_back (initAddr);
279
279
return ResultPlanPtr (new InPlaceInitializationResultPlan (init));
280
280
}
281
281
}
@@ -291,12 +291,12 @@ ResultPlanPtr ResultPlanBuilder::build(Initialization *init,
291
291
std::unique_ptr<TemporaryInitialization> temporary;
292
292
if (SGF.silConv .isSILIndirect (result)) {
293
293
auto &resultTL = SGF.getTypeLowering (result.getType ());
294
- temporary = SGF.emitTemporary (Loc , resultTL);
295
- IndirectResultAddrs .push_back (temporary->getAddress ());
294
+ temporary = SGF.emitTemporary (loc , resultTL);
295
+ indirectResultAddrs .push_back (temporary->getAddress ());
296
296
}
297
297
298
298
return ResultPlanPtr (
299
- new ScalarResultPlan (std::move (temporary), origType, init, Rep ));
299
+ new ScalarResultPlan (std::move (temporary), origType, init, rep ));
300
300
}
301
301
302
302
ResultPlanPtr ResultPlanBuilder::buildForTuple (Initialization *init,
@@ -324,7 +324,7 @@ ResultPlanPtr ResultPlanBuilder::buildForTuple(Initialization *init,
324
324
auto &substTL = SGF.getTypeLowering (substType);
325
325
if (substTL.isAddressOnly ()) {
326
326
// Create a temporary.
327
- auto temporary = SGF.emitTemporary (Loc , substTL);
327
+ auto temporary = SGF.emitTemporary (loc , substTL);
328
328
329
329
// Build a sub-plan to emit into the temporary.
330
330
auto subplan = buildForTuple (temporary.get (), origType, substType);
0 commit comments