Skip to content

Commit 8e2b127

Browse files
committed
[NFC] Clang-formatted 8e9dec2.
The commit with the following message wasn't previously formatted. That oversight is fixed here. [NFC] Construct AsyncContextLayout from module. Previously, an IRGenFunction was being passed to the functions that construct an AsyncContextLayout. That was not actually necessary and prevented construction of the layout in contexts where no IRGenFunction was present. Here that requirement is eased to requiring an IRGenModule which is indeed required to construct an AsyncContextLayout.
1 parent e723550 commit 8e2b127

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ AsyncContextLayout irgen::getAsyncContextLayout(IRGenModule &IGM,
9191
return layout;
9292
}
9393

94-
AsyncContextLayout irgen::getAsyncContextLayout(
95-
IRGenModule &IGM, CanSILFunctionType originalType,
96-
CanSILFunctionType substitutedType, SubstitutionMap substitutionMap) {
94+
AsyncContextLayout
95+
irgen::getAsyncContextLayout(IRGenModule &IGM, CanSILFunctionType originalType,
96+
CanSILFunctionType substitutedType,
97+
SubstitutionMap substitutionMap) {
9798
SmallVector<const TypeInfo *, 4> typeInfos;
9899
SmallVector<SILType, 4> valTypes;
99100
SmallVector<AsyncContextLayout::ArgumentInfo, 4> paramInfos;
@@ -158,8 +159,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
158159
// IndirectResultTypes *indirectResults...;
159160
auto indirectResults = fnConv.getIndirectSILResults();
160161
for (auto indirectResult : indirectResults) {
161-
auto ty = fnConv.getSILType(indirectResult,
162-
IGM.getMaximalTypeExpansionContext());
162+
auto ty =
163+
fnConv.getSILType(indirectResult, IGM.getMaximalTypeExpansionContext());
163164
auto retLoweringTy = CanInOutType::get(ty.getASTType());
164165
auto &ti = IGM.getTypeInfoForLowered(retLoweringTy);
165166
valTypes.push_back(ty);
@@ -177,8 +178,7 @@ AsyncContextLayout irgen::getAsyncContextLayout(
177178
addExecutor();
178179
// YieldTypes yieldValues...
179180
for (auto yield : fnConv.getYields()) {
180-
auto ty =
181-
fnConv.getSILType(yield, IGM.getMaximalTypeExpansionContext());
181+
auto ty = fnConv.getSILType(yield, IGM.getMaximalTypeExpansionContext());
182182
auto &ti = IGM.getTypeInfoForLowered(ty.getASTType());
183183
valTypes.push_back(ty);
184184
typeInfos.push_back(&ti);
@@ -187,8 +187,7 @@ AsyncContextLayout irgen::getAsyncContextLayout(
187187
} else {
188188
// ResultTypes directResults...;
189189
for (auto result : fnConv.getDirectSILResults()) {
190-
auto ty =
191-
fnConv.getSILType(result, IGM.getMaximalTypeExpansionContext());
190+
auto ty = fnConv.getSILType(result, IGM.getMaximalTypeExpansionContext());
192191
auto &ti = IGM.getTypeInfoForLowered(ty.getASTType());
193192
valTypes.push_back(ty);
194193
typeInfos.push_back(&ti);
@@ -208,8 +207,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
208207

209208
// ArgTypes formalArguments...;
210209
for (auto parameter : parameters) {
211-
SILType ty = IGM.silConv.getSILType(
212-
parameter, substitutedType, IGM.getMaximalTypeExpansionContext());
210+
SILType ty = IGM.silConv.getSILType(parameter, substitutedType,
211+
IGM.getMaximalTypeExpansionContext());
213212

214213
auto argumentLoweringType =
215214
getArgumentLoweringType(ty.getASTType(), parameter,
@@ -225,8 +224,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
225224
IGM, originalType, substitutionMap);
226225
if (!bindings.empty()) {
227226
auto bindingsSize = bindings.getBufferSize(IGM);
228-
auto &bindingsTI = IGM.getOpaqueStorageTypeInfo(
229-
bindingsSize, IGM.getPointerAlignment());
227+
auto &bindingsTI =
228+
IGM.getOpaqueStorageTypeInfo(bindingsSize, IGM.getPointerAlignment());
230229
valTypes.push_back(SILType());
231230
typeInfos.push_back(&bindingsTI);
232231
}
@@ -236,7 +235,7 @@ AsyncContextLayout irgen::getAsyncContextLayout(
236235
if (hasLocalContextParameter) {
237236
SILType ty =
238237
IGM.silConv.getSILType(localContextParameter, substitutedType,
239-
IGM.getMaximalTypeExpansionContext());
238+
IGM.getMaximalTypeExpansionContext());
240239
auto argumentLoweringType =
241240
getArgumentLoweringType(ty.getASTType(), localContextParameter,
242241
/*isNoEscape*/ true);
@@ -278,19 +277,19 @@ AsyncContextLayout irgen::getAsyncContextLayout(
278277
trailingWitnessInfo = AsyncContextLayout::TrailingWitnessInfo();
279278
}
280279

281-
return AsyncContextLayout(
282-
IGM, LayoutStrategy::Optimal, valTypes, typeInfos, originalType,
283-
substitutedType, substitutionMap, std::move(bindings),
284-
trailingWitnessInfo, errorType, canHaveValidError, paramInfos,
285-
isCoroutine, yieldInfos, indirectReturnInfos, directReturnInfos,
286-
localContextInfo);
280+
return AsyncContextLayout(IGM, LayoutStrategy::Optimal, valTypes, typeInfos,
281+
originalType, substitutedType, substitutionMap,
282+
std::move(bindings), trailingWitnessInfo, errorType,
283+
canHaveValidError, paramInfos, isCoroutine,
284+
yieldInfos, indirectReturnInfos, directReturnInfos,
285+
localContextInfo);
287286
}
288287

289288
AsyncContextLayout::AsyncContextLayout(
290289
IRGenModule &IGM, LayoutStrategy strategy, ArrayRef<SILType> fieldTypes,
291-
ArrayRef<const TypeInfo *> fieldTypeInfos,
292-
CanSILFunctionType originalType, CanSILFunctionType substitutedType,
293-
SubstitutionMap substitutionMap, NecessaryBindings &&bindings,
290+
ArrayRef<const TypeInfo *> fieldTypeInfos, CanSILFunctionType originalType,
291+
CanSILFunctionType substitutedType, SubstitutionMap substitutionMap,
292+
NecessaryBindings &&bindings,
294293
Optional<TrailingWitnessInfo> trailingWitnessInfo, SILType errorType,
295294
bool canHaveValidError, ArrayRef<ArgumentInfo> argumentInfos,
296295
bool isCoroutine, ArrayRef<SILYieldInfo> yieldInfos,

lib/IRGen/GenCall.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ namespace irgen {
255255
// AsyncContextLayout.
256256
SILType getParameterType(unsigned index) {
257257
SILFunctionConventions origConv(substitutedType, IGM.getSILModule());
258-
return origConv.getSILArgumentType(
259-
index, IGM.getMaximalTypeExpansionContext());
258+
return origConv.getSILArgumentType(index,
259+
IGM.getMaximalTypeExpansionContext());
260260
}
261261
unsigned getArgumentCount() { return argumentInfos.size(); }
262262
bool hasTrailingWitnesses() { return (bool)trailingWitnessInfo; }

0 commit comments

Comments
 (0)