[Distributed] Generate thunk for accessor as a regular method

It used to be an accessor but that is not required because
SILDeclRef controls mangling which is the most imprortant
and could be used to emit the right reference.
This commit is contained in:
Pavel Yaskevich
2022-06-29 17:39:42 -07:00
parent d9a0130384
commit 2480c99dee
5 changed files with 32 additions and 45 deletions

View File

@@ -725,25 +725,10 @@ static FuncDecl *createDistributedThunkFunction(FuncDecl *func) {
}
ParameterList *params = ParameterList::create(C, paramDecls); // = funcParams->clone(C);
FuncDecl *thunk = nullptr;
if (auto *accessor = dyn_cast<AccessorDecl>(func)) {
auto *distributedVar = cast<VarDecl>(accessor->getStorage());
thunk = AccessorDecl::create(
C, /*declLoc=*/accessor->getLoc(), /*accessorKeywordLoc=*/SourceLoc(),
AccessorKind::Get, distributedVar,
/*staticLoc=*/SourceLoc(), StaticSpellingKind::None,
/*async=*/true, /*asyncLoc=*/SourceLoc(),
/*throws=*/true, /*throwsLoc=*/SourceLoc(), genericParamList, params,
func->getResultInterfaceType(), accessor->getDeclContext());
thunk->setImplicit();
} else {
thunk = FuncDecl::createImplicit(
C, swift::StaticSpellingKind::None, func->getName(), SourceLoc(),
/*async=*/true, /*throws=*/true, genericParamList, params,
func->getResultInterfaceType(), DC);
}
FuncDecl *thunk = FuncDecl::createImplicit(
C, swift::StaticSpellingKind::None, thunkName, SourceLoc(),
/*async=*/true, /*throws=*/true, genericParamList, params,
func->getResultInterfaceType(), DC);
assert(thunk && "couldn't create a distributed thunk");