diff --git a/lib/SIL/IR/SILDeclRef.cpp b/lib/SIL/IR/SILDeclRef.cpp index 174f909c354..ea019127664 100644 --- a/lib/SIL/IR/SILDeclRef.cpp +++ b/lib/SIL/IR/SILDeclRef.cpp @@ -914,6 +914,10 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const { return CDeclA->Name.str(); } + if (SKind == ASTMangler::SymbolKind::DistributedThunk) { + return mangler.mangleDistributedThunk(cast(getDecl())); + } + // Otherwise, fall through into the 'other decl' case. LLVM_FALLTHROUGH; diff --git a/lib/Sema/CodeSynthesisDistributedActor.cpp b/lib/Sema/CodeSynthesisDistributedActor.cpp index 3516f0108a6..72ba5166fcf 100644 --- a/lib/Sema/CodeSynthesisDistributedActor.cpp +++ b/lib/Sema/CodeSynthesisDistributedActor.cpp @@ -375,11 +375,10 @@ deriveBodyDistributed_thunk(AbstractFunctionDecl *thunk, void *context) { { // --- Mangle the thunk name Mangle::ASTMangler mangler; - auto symbolKind = swift::Mangle::ASTMangler::SymbolKind::DistributedThunk; - auto mangled = C.AllocateCopy(mangler.mangleEntity(thunk, symbolKind)); - StringRef mangledTargetStringRef = StringRef(mangled); - auto mangledTargetStringLiteral = new (C) - StringLiteralExpr(mangledTargetStringRef, SourceRange(), implicit); + auto mangled = + C.AllocateCopy(mangler.mangleDistributedThunk(cast(thunk))); + auto mangledTargetStringLiteral = + new (C) StringLiteralExpr(mangled, SourceRange(), implicit); // --- let target = RemoteCallTarget() targetVar->setInterfaceType(remoteCallTargetTy);