Skip to content

Commit f404c8a

Browse files
committed
[Distributed] Inject "unsafe" expression for synthesized unsafe code
1 parent 170845b commit f404c8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/DerivedConformanceDistributedActor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ deriveBodyDistributed_doInvokeOnReturn(AbstractFunctionDecl *afd, void *arg) {
156156
new (C) VarDecl(/*isStatic=*/false, VarDecl::Introducer::Let, sloc,
157157
C.getIdentifier("result"), afd);
158158
{
159-
auto resultLoadCall = CallExpr::createImplicit(
159+
Expr *resultLoadCall = CallExpr::createImplicit(
160160
C,
161161
UnresolvedDotExpr::createImplicit(
162162
C,
@@ -171,6 +171,9 @@ deriveBodyDistributed_doInvokeOnReturn(AbstractFunctionDecl *afd, void *arg) {
171171
new (C) DeclRefExpr(ConcreteDeclRef(returnTypeParam),
172172
dloc, implicit))}));
173173

174+
if (C.LangOpts.hasFeature(Feature::StrictMemorySafety))
175+
resultLoadCall = new (C) UnsafeExpr(sloc, resultLoadCall, Type(), true);
176+
174177
auto resultPattern = NamedPattern::createImplicit(C, resultVar);
175178
auto resultPB = PatternBindingDecl::createImplicit(
176179
C, swift::StaticSpellingKind::None, resultPattern,

0 commit comments

Comments
 (0)