@@ -887,14 +887,8 @@ class PrintAST : public ASTVisitor<PrintAST> {
887887 return ;
888888 if (D->getDeclContext ()->isLocalContext ())
889889 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 ());
898892 bool shouldSkipSetterAccess =
899893 llvm::is_contained (Options.ExcludeAttrList , DeclAttrKind::SetterAccess);
900894
@@ -1423,14 +1417,6 @@ void PrintAST::printAttributes(const Decl *D) {
14231417 scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Consuming);
14241418 scope.Options .ExcludeAttrList .push_back (DeclAttrKind::Borrowing);
14251419 }
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- }
14341420
14351421 attrs.print (Printer, Options, D);
14361422}
@@ -3234,33 +3220,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
32343220 }
32353221}
32363222
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-
32643223static void
32653224suppressingFeatureLifetimes (PrintOptions &options,
32663225 llvm::function_ref<void ()> action) {
@@ -3287,20 +3246,6 @@ struct ExcludeAttrRAII {
32873246};
32883247}
32893248
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-
33043249static void
33053250suppressingFeatureCoroutineAccessors (PrintOptions &options,
33063251 llvm::function_ref<void ()> action) {
@@ -3604,28 +3549,17 @@ void PrintAST::visitOpaqueTypeDecl(OpaqueTypeDecl *decl) {
36043549
36053550void PrintAST::visitTypeAliasDecl (TypeAliasDecl *decl) {
36063551 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- }
36143552 printDocumentationComment (decl);
36153553 printAttributes (decl);
36163554 printAccess (decl);
36173555 Printer.printIntroducerKeyword (" typealias" , Options, " " );
36183556 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+ });
36293563 bool ShouldPrint = true ;
36303564 Type Ty = decl->getUnderlyingType ();
36313565
@@ -3821,11 +3755,6 @@ void PrintAST::printPrimaryAssociatedTypes(ProtocolDecl *decl) {
38213755
38223756void PrintAST::visitProtocolDecl (ProtocolDecl *decl) {
38233757 auto name = decl->getName ();
3824- if (Options.SuppressBitwiseCopyable &&
3825- decl->getModuleContext ()->isStdlibModule () &&
3826- (decl->getNameStr () == " BitwiseCopyable" )) {
3827- name = decl->getASTContext ().getIdentifier (" _BitwiseCopyable" );
3828- }
38293758 printDocumentationComment (decl);
38303759 printAttributes (decl);
38313760 printAccess (decl);
@@ -3918,17 +3847,7 @@ static void printParameterFlags(ASTPrinter &printer,
39183847 }
39193848
39203849 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, " " );
39323851 }
39333852
39343853 if (flags.isIsolated ()) {
@@ -4391,14 +4310,12 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
43914310 Printer.printDeclResultTypePre (decl, ResultTyLoc);
43924311 Printer.callPrintStructurePre (PrintStructureKind::FunctionReturnType);
43934312
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 ()) {
43964318 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- }
44024319 }
44034320 }
44044321
@@ -4571,12 +4488,10 @@ void PrintAST::visitSubscriptDecl(SubscriptDecl *decl) {
45714488 Printer.printDeclResultTypePre (decl, elementTy);
45724489 Printer.callPrintStructurePre (PrintStructureKind::FunctionReturnType);
45734490
4574- if (!Options.SuppressSendingArgsAndResults ) {
45754491 if (decl->getElementTypeRepr ()) {
45764492 if (isa<SendingTypeRepr>(decl->getResultTypeRepr ()))
45774493 Printer << " sending " ;
45784494 }
4579- }
45804495
45814496 PrintWithOpaqueResultTypeKeywordRAII x (Options);
45824497 auto nrOptions = getNonRecursiveOptions (decl);
@@ -6581,8 +6496,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
65816496 break ;
65826497
65836498 case FunctionTypeIsolation::Kind::Erased:
6584- if (!Options.SuppressIsolatedAny )
6585- Printer << " @isolated(any) " ;
6499+ Printer << " @isolated(any) " ;
65866500 break ;
65876501
65886502 case FunctionTypeIsolation::Kind::NonIsolatedCaller:
@@ -6863,8 +6777,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
68636777
68646778 Printer << " -> " ;
68656779
6866- if (!Options.SuppressSendingArgsAndResults && T->hasExtInfo () &&
6867- T->hasSendingResult ()) {
6780+ if (T->hasExtInfo () && T->hasSendingResult ()) {
68686781 Printer.printKeyword (" sending " , Options);
68696782 }
68706783
0 commit comments