@@ -887,14 +887,8 @@ class PrintAST : public ASTVisitor<PrintAST> {
887
887
return ;
888
888
if (D->getDeclContext ()->isLocalContext ())
889
889
return ;
890
-
891
- if (Options.SuppressIsolatedDeinit &&
892
- D->getFormalAccess () == AccessLevel::Open &&
893
- usesFeatureIsolatedDeinit (D)) {
894
- printAccess (AccessLevel::Public);
895
- } else {
896
- printAccess (D->getFormalAccess ());
897
- }
890
+
891
+ printAccess (D->getFormalAccess ());
898
892
bool shouldSkipSetterAccess =
899
893
llvm::is_contained (Options.ExcludeAttrList , DeclAttrKind::SetterAccess);
900
894
@@ -1423,14 +1417,6 @@ void PrintAST::printAttributes(const Decl *D) {
1423
1417
scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Consuming);
1424
1418
scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Borrowing);
1425
1419
}
1426
-
1427
- if (isa<DestructorDecl>(D) && Options.SuppressIsolatedDeinit ) {
1428
- scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Nonisolated);
1429
- scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Isolated);
1430
- if (auto globalActor = D->getGlobalActorAttr ()) {
1431
- scope.Options .ExcludeCustomAttrList .push_back (globalActor->first );
1432
- }
1433
- }
1434
1420
1435
1421
attrs.print (Printer, Options, D);
1436
1422
}
@@ -3234,33 +3220,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
3234
3220
}
3235
3221
}
3236
3222
3237
- static void suppressingFeatureIsolatedAny (PrintOptions &options,
3238
- llvm::function_ref<void ()> action) {
3239
- llvm::SaveAndRestore<bool > scope (options.SuppressIsolatedAny , true );
3240
- action ();
3241
- }
3242
-
3243
- static void
3244
- suppressingFeatureSendingArgsAndResults (PrintOptions &options,
3245
- llvm::function_ref<void ()> action) {
3246
- llvm::SaveAndRestore<bool > scope (options.SuppressSendingArgsAndResults , true );
3247
- action ();
3248
- }
3249
-
3250
- static void
3251
- suppressingFeatureBitwiseCopyable2 (PrintOptions &options,
3252
- llvm::function_ref<void ()> action) {
3253
- llvm::SaveAndRestore<bool > scope (options.SuppressBitwiseCopyable , true );
3254
- action ();
3255
- }
3256
-
3257
- static void
3258
- suppressingFeatureIsolatedDeinit (PrintOptions &options,
3259
- llvm::function_ref<void ()> action) {
3260
- llvm::SaveAndRestore<bool > scope (options.SuppressIsolatedDeinit , true );
3261
- action ();
3262
- }
3263
-
3264
3223
static void
3265
3224
suppressingFeatureLifetimes (PrintOptions &options,
3266
3225
llvm::function_ref<void ()> action) {
@@ -3287,20 +3246,6 @@ struct ExcludeAttrRAII {
3287
3246
};
3288
3247
}
3289
3248
3290
- static void
3291
- suppressingFeatureMemorySafetyAttributes (PrintOptions &options,
3292
- llvm::function_ref<void ()> action) {
3293
- ExcludeAttrRAII scope (options.ExcludeAttrList , DeclAttrKind::Unsafe);
3294
- ExcludeAttrRAII scope2 (options.ExcludeAttrList , DeclAttrKind::Safe);
3295
- options.ExcludeAttrList .push_back (TypeAttrKind::Unsafe);
3296
- SWIFT_DEFER {
3297
- assert (options.ExcludeAttrList .back () == TypeAttrKind::Unsafe);
3298
- options.ExcludeAttrList .pop_back ();
3299
- };
3300
-
3301
- action ();
3302
- }
3303
-
3304
3249
static void
3305
3250
suppressingFeatureCoroutineAccessors (PrintOptions &options,
3306
3251
llvm::function_ref<void ()> action) {
@@ -3604,28 +3549,17 @@ void PrintAST::visitOpaqueTypeDecl(OpaqueTypeDecl *decl) {
3604
3549
3605
3550
void PrintAST::visitTypeAliasDecl (TypeAliasDecl *decl) {
3606
3551
auto name = decl->getName ();
3607
- bool suppressingBitwiseCopyable =
3608
- Options.SuppressBitwiseCopyable &&
3609
- decl->getModuleContext ()->isStdlibModule () &&
3610
- (decl->getNameStr () == " _BitwiseCopyable" );
3611
- if (suppressingBitwiseCopyable) {
3612
- name = decl->getASTContext ().getIdentifier (" BitwiseCopyable" );
3613
- }
3614
3552
printDocumentationComment (decl);
3615
3553
printAttributes (decl);
3616
3554
printAccess (decl);
3617
3555
Printer.printIntroducerKeyword (" typealias" , Options, " " );
3618
3556
printContextIfNeeded (decl);
3619
- recordDeclLoc (decl,
3620
- [&]{
3621
- Printer.printName (name, getTypeMemberPrintNameContext (decl));
3622
- }, [&]{ // Signature
3623
- printGenericDeclGenericParams (decl);
3624
- });
3625
- if (suppressingBitwiseCopyable) {
3626
- Printer << " = Swift._BitwiseCopyable" ;
3627
- return ;
3628
- }
3557
+ recordDeclLoc (
3558
+ decl,
3559
+ [&] { Printer.printName (name, getTypeMemberPrintNameContext (decl)); },
3560
+ [&] { // Signature
3561
+ printGenericDeclGenericParams (decl);
3562
+ });
3629
3563
bool ShouldPrint = true ;
3630
3564
Type Ty = decl->getUnderlyingType ();
3631
3565
@@ -3821,11 +3755,6 @@ void PrintAST::printPrimaryAssociatedTypes(ProtocolDecl *decl) {
3821
3755
3822
3756
void PrintAST::visitProtocolDecl (ProtocolDecl *decl) {
3823
3757
auto name = decl->getName ();
3824
- if (Options.SuppressBitwiseCopyable &&
3825
- decl->getModuleContext ()->isStdlibModule () &&
3826
- (decl->getNameStr () == " BitwiseCopyable" )) {
3827
- name = decl->getASTContext ().getIdentifier (" _BitwiseCopyable" );
3828
- }
3829
3758
printDocumentationComment (decl);
3830
3759
printAttributes (decl);
3831
3760
printAccess (decl);
@@ -3918,17 +3847,7 @@ static void printParameterFlags(ASTPrinter &printer,
3918
3847
}
3919
3848
3920
3849
if (flags.isSending ()) {
3921
- if (!options.SuppressSendingArgsAndResults ) {
3922
- printer.printKeyword (" sending" , options, " " );
3923
- } else if (flags.getOwnershipSpecifier () ==
3924
- ParamSpecifier::ImplicitlyCopyableConsuming) {
3925
- // Ok. We are suppressing sending. If our ownership specifier was
3926
- // originally implicitly copyable consuming our argument was being passed
3927
- // at +1. By not printing sending, we would be changing the API
3928
- // potentially to take the parameter at +0 instead of +1. To work around
3929
- // this, print out consuming so that we preserve the +1 parameter.
3930
- printer.printKeyword (" __owned" , options, " " );
3931
- }
3850
+ printer.printKeyword (" sending" , options, " " );
3932
3851
}
3933
3852
3934
3853
if (flags.isIsolated ()) {
@@ -4391,14 +4310,12 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
4391
4310
Printer.printDeclResultTypePre (decl, ResultTyLoc);
4392
4311
Printer.callPrintStructurePre (PrintStructureKind::FunctionReturnType);
4393
4312
4394
- if (!Options.SuppressSendingArgsAndResults ) {
4395
- if (decl->hasSendingResult ()) {
4313
+ if (decl->hasSendingResult ()) {
4314
+ Printer << " sending " ;
4315
+ } else if (auto *ft = llvm::dyn_cast_if_present<AnyFunctionType>(
4316
+ decl->getInterfaceType ())) {
4317
+ if (ft->hasExtInfo () && ft->hasSendingResult ()) {
4396
4318
Printer << " sending " ;
4397
- } else if (auto *ft = llvm::dyn_cast_if_present<AnyFunctionType>(
4398
- decl->getInterfaceType ())) {
4399
- if (ft->hasExtInfo () && ft->hasSendingResult ()) {
4400
- Printer << " sending " ;
4401
- }
4402
4319
}
4403
4320
}
4404
4321
@@ -4571,12 +4488,10 @@ void PrintAST::visitSubscriptDecl(SubscriptDecl *decl) {
4571
4488
Printer.printDeclResultTypePre (decl, elementTy);
4572
4489
Printer.callPrintStructurePre (PrintStructureKind::FunctionReturnType);
4573
4490
4574
- if (!Options.SuppressSendingArgsAndResults ) {
4575
4491
if (decl->getElementTypeRepr ()) {
4576
4492
if (isa<SendingTypeRepr>(decl->getResultTypeRepr ()))
4577
4493
Printer << " sending " ;
4578
4494
}
4579
- }
4580
4495
4581
4496
PrintWithOpaqueResultTypeKeywordRAII x (Options);
4582
4497
auto nrOptions = getNonRecursiveOptions (decl);
@@ -6581,8 +6496,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
6581
6496
break ;
6582
6497
6583
6498
case FunctionTypeIsolation::Kind::Erased:
6584
- if (!Options.SuppressIsolatedAny )
6585
- Printer << " @isolated(any) " ;
6499
+ Printer << " @isolated(any) " ;
6586
6500
break ;
6587
6501
6588
6502
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
@@ -6863,8 +6777,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
6863
6777
6864
6778
Printer << " -> " ;
6865
6779
6866
- if (!Options.SuppressSendingArgsAndResults && T->hasExtInfo () &&
6867
- T->hasSendingResult ()) {
6780
+ if (T->hasExtInfo () && T->hasSendingResult ()) {
6868
6781
Printer.printKeyword (" sending " , Options);
6869
6782
}
6870
6783
0 commit comments