@@ -1970,29 +1970,21 @@ class AsyncCallEmission final : public CallEmission {
1970
1970
llArgs.add (selfValue);
1971
1971
}
1972
1972
auto layout = getAsyncContextLayout ();
1973
- auto params = fnConv.getParameters ();
1974
- for (auto index : indices (params)) {
1975
- Optional<ElementLayout> fieldLayout;
1976
- if (selfValue && index == params.size () - 1 ) {
1977
- fieldLayout = layout.getLocalContextLayout ();
1978
- } else {
1979
- fieldLayout = layout.getArgumentLayout (index);
1980
- }
1973
+ for (unsigned index = 0 , count = layout.getArgumentCount (); index < count;
1974
+ ++index) {
1975
+ auto fieldLayout = layout.getArgumentLayout (index);
1981
1976
Address fieldAddr =
1982
- fieldLayout-> project (IGF, context, /* offsets*/ llvm::None);
1983
- auto &ti = cast<LoadableTypeInfo>(fieldLayout-> getType ());
1977
+ fieldLayout. project (IGF, context, /* offsets*/ llvm::None);
1978
+ auto &ti = cast<LoadableTypeInfo>(fieldLayout. getType ());
1984
1979
ti.initialize (IGF, llArgs, fieldAddr, isOutlined);
1985
1980
}
1986
- unsigned index = 0 ;
1987
- for (auto indirectResult : fnConv.getIndirectSILResultTypes (
1988
- IGF.IGM .getMaximalTypeExpansionContext ())) {
1989
- (void )indirectResult;
1981
+ for (unsigned index = 0 , count = layout.getIndirectReturnCount ();
1982
+ index < count; ++index) {
1990
1983
auto fieldLayout = layout.getIndirectReturnLayout (index);
1991
1984
Address fieldAddr =
1992
1985
fieldLayout.project (IGF, context, /* offsets*/ llvm::None);
1993
1986
cast<LoadableTypeInfo>(fieldLayout.getType ())
1994
1987
.initialize (IGF, llArgs, fieldAddr, isOutlined);
1995
- ++index;
1996
1988
}
1997
1989
if (layout.hasBindings ()) {
1998
1990
auto bindingLayout = layout.getBindingsLayout ();
@@ -2024,15 +2016,14 @@ class AsyncCallEmission final : public CallEmission {
2024
2016
Explosion nativeExplosion;
2025
2017
auto layout = getAsyncContextLayout ();
2026
2018
auto dataAddr = layout.emitCastTo (IGF, context);
2027
- int index = layout.getFirstDirectReturnIndex ();
2028
- for ( auto result : fnConv. getDirectSILResults () ) {
2029
- auto & fieldLayout = layout.getElement (index);
2019
+ for ( unsigned index = 0 , count = layout.getDirectReturnCount ();
2020
+ index < count; ++index ) {
2021
+ auto fieldLayout = layout.getDirectReturnLayout (index);
2030
2022
Address fieldAddr =
2031
2023
fieldLayout.project (IGF, dataAddr, /* offsets*/ llvm::None);
2032
2024
auto &fieldTI = fieldLayout.getType ();
2033
2025
cast<LoadableTypeInfo>(fieldTI).loadAsTake (IGF, fieldAddr,
2034
2026
nativeExplosion);
2035
- ++index;
2036
2027
}
2037
2028
2038
2029
out = nativeSchema.mapFromNative (IGF.IGM , IGF, nativeExplosion, resultType);
0 commit comments