Skip to content

Commit 5fe0c03

Browse files
committed
Allow functions marked @LLDBDebuggerFunction to bypass actor isolation checks
In order to allow LLDB to evaluate expressions inside an actor without spawining async functions and potentially continue all threads, this relaxes the actor isolation checks in @LLDBDebuggerFunction functions to allow a synchronous call into an extension method. rdar://75905336
1 parent a4e71aa commit 5fe0c03

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2391,6 +2391,10 @@ void swift::checkTopLevelActorIsolation(TopLevelCodeDecl *decl) {
23912391
}
23922392

23932393
void swift::checkFunctionActorIsolation(AbstractFunctionDecl *decl) {
2394+
// Disable this check for @LLDBDebuggerFunction functions.
2395+
if (decl->getAttrs().hasAttribute<LLDBDebuggerFunctionAttr>())
2396+
return;
2397+
23942398
ActorIsolationChecker checker(decl);
23952399
if (auto body = decl->getBody()) {
23962400
body->walk(checker);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -debugger-support
2+
// REQUIRES: concurrency
3+
4+
// This test simulates LLDB's expression evaluator makeing an otherwise illegal
5+
// synchronous call into an extension of an actor, as it would to run `p n` in
6+
// this example.
7+
8+
actor A {
9+
var n : Int = 0
10+
}
11+
12+
extension A {
13+
final func lldb_wrapped_expr() {
14+
n = 1
15+
}
16+
}
17+
18+
@LLDBDebuggerFunction
19+
func lldb_expr(a: A) {
20+
a.lldb_wrapped_expr()
21+
}

0 commit comments

Comments
 (0)