Skip to content

Commit 6901f2a

Browse files
authored
Add feature for _implicitSelfCapture attribute. (swiftlang#37335)
Fixes rdar://77681413.
1 parent ab8b0a5 commit 6901f2a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ LANGUAGE_FEATURE(BuiltinExecutor, 0, "Executor builtins", true)
4848
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
4949
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
5050
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
51+
LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true)
5152

5253
#undef LANGUAGE_FEATURE

lib/AST/ASTPrinter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,17 @@ static bool usesFeatureInheritActorContext(Decl *decl) {
27992799
return false;
28002800
}
28012801

2802+
static bool usesFeatureImplicitSelfCapture(Decl *decl) {
2803+
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
2804+
for (auto param : *func->getParameters()) {
2805+
if (param->getAttrs().hasAttribute<ImplicitSelfCaptureAttr>())
2806+
return true;
2807+
}
2808+
}
2809+
2810+
return false;
2811+
}
2812+
28022813
/// Determine the set of "new" features used on a given declaration.
28032814
///
28042815
/// Note: right now, all features we check for are "new". At some point, we'll

0 commit comments

Comments
 (0)