Skip to content

Commit a4db7c8

Browse files
authored
Merge pull request #36560 from DougGregor/show-imported-main-actor
2 parents bf48fcf + a109736 commit a4db7c8

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/AST/Attr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
10201020
type.print(Printer, Options);
10211021
else
10221022
attr->getTypeRepr()->print(Printer, Options);
1023-
if (attr->isArgUnsafe())
1023+
if (attr->isArgUnsafe() && Options.IsForSwiftInterface)
10241024
Printer << "(unsafe)";
10251025
Printer.printNamePost(PrintNameContext::Attribute);
10261026
break;

lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8189,8 +8189,6 @@ void ClangImporter::Implementation::importAttributes(
81898189
auto typeExpr = TypeExpr::createImplicit(mainActorType, SwiftContext);
81908190
auto attr = CustomAttr::create(SwiftContext, SourceLoc(), typeExpr);
81918191
attr->setArgIsUnsafe(isUnsafe);
8192-
if (isUnsafe)
8193-
attr->setImplicit();
81948192
MappedDecl->getAttrs().add(attr);
81958193
}
81968194

test/IDE/print_clang_objc_async.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ import _Concurrency
3939
// CHECK-LABEL: protocol ProtocolWithSwiftAttributes {
4040
// CHECK-NEXT: @actorIndependent func independentMethod()
4141
// CHECK-NEXT: @asyncHandler func asyncHandlerMethod()
42-
// CHECK-NEXT: {{^}} func mainActorMethod()
43-
// CHECK-NEXT: {{^}} func uiActorMethod()
42+
// CHECK-NEXT: {{^}} @MainActor func mainActorMethod()
43+
// CHECK-NEXT: {{^}} @MainActor func uiActorMethod()
4444
// CHECK-NEXT: {{^}} optional func missingAtAttributeMethod()
4545
// CHECK-NEXT: {{^[}]$}}
4646

0 commit comments

Comments
 (0)