@@ -543,6 +543,25 @@ static void printShortFormAvailable(ArrayRef<const DeclAttribute *> Attrs,
543
543
Printer.printNewline ();
544
544
}
545
545
546
+ static void printShortFormBackDeployed (ArrayRef<const DeclAttribute *> Attrs,
547
+ ASTPrinter &Printer,
548
+ const PrintOptions &Options) {
549
+ assert (!Attrs.empty ());
550
+ Printer << " @_backDeploy(before: " ;
551
+ bool isFirst = true ;
552
+
553
+ for (auto *DA : Attrs) {
554
+ if (!isFirst)
555
+ Printer << " , " ;
556
+ auto *attr = cast<BackDeployAttr>(DA);
557
+ Printer << platformString (attr->Platform ) << " "
558
+ << attr->Version .getAsString ();
559
+ isFirst = false ;
560
+ }
561
+ Printer << " )" ;
562
+ Printer.printNewline ();
563
+ }
564
+
546
565
// / The kind of a parameter in a `wrt:` differentiation parameters clause:
547
566
// / either a differentiability parameter or a linearity parameter. Used for
548
567
// / printing `@differentiable`, `@derivative`, and `@transpose` attributes.
@@ -754,6 +773,7 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
754
773
AttributeVector shortAvailableAttributes;
755
774
const DeclAttribute *swiftVersionAvailableAttribute = nullptr ;
756
775
const DeclAttribute *packageDescriptionVersionAvailableAttribute = nullptr ;
776
+ AttributeVector backDeployAttributes;
757
777
AttributeVector longAttributes;
758
778
AttributeVector attributes;
759
779
AttributeVector modifiers;
@@ -791,6 +811,7 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
791
811
}
792
812
793
813
AttributeVector &which = DA->isDeclModifier () ? modifiers :
814
+ isa<BackDeployAttr>(DA) ? backDeployAttributes :
794
815
isShortAvailable (DA) ? shortAvailableAttributes :
795
816
DA->isLongAttribute () ? longAttributes :
796
817
attributes;
@@ -803,6 +824,8 @@ void DeclAttributes::print(ASTPrinter &Printer, const PrintOptions &Options,
803
824
printShortFormAvailable (packageDescriptionVersionAvailableAttribute, Printer, Options);
804
825
if (!shortAvailableAttributes.empty ())
805
826
printShortFormAvailable (shortAvailableAttributes, Printer, Options);
827
+ if (!backDeployAttributes.empty ())
828
+ printShortFormBackDeployed (backDeployAttributes, Printer, Options);
806
829
807
830
for (auto DA : longAttributes)
808
831
DA->print (Printer, Options, D);
0 commit comments