@@ -1275,14 +1275,17 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
12751275 Printer << " (" << cast<AlignmentAttr>(this )->getValue () << " )" ;
12761276 break ;
12771277
1278- case DeclAttrKind::AllowFeatureSuppression:
1279- Printer.printAttrName (" @_allowFeatureSuppression" );
1278+ case DeclAttrKind::AllowFeatureSuppression: {
1279+ auto Attr = cast<AllowFeatureSuppressionAttr>(this );
1280+ Printer.printAttrName (Attr->getInverted () ? " @_disallowFeatureSuppression"
1281+ : " @_allowFeatureSuppression" );
12801282 Printer << " (" ;
1281- interleave (cast<AllowFeatureSuppressionAttr>( this )-> getSuppressedFeatures (),
1282- [&](Identifier ident) { Printer << ident; } ,
1283- [&] { Printer << " , " ; });
1283+ interleave (
1284+ Attr-> getSuppressedFeatures () ,
1285+ [&](Identifier ident) { Printer << ident; }, [&] { Printer << " , " ; });
12841286 Printer << " )" ;
12851287 break ;
1288+ }
12861289
12871290 case DeclAttrKind::SILGenName:
12881291 Printer.printAttrName (" @_silgen_name" );
@@ -1947,7 +1950,11 @@ StringRef DeclAttribute::getAttrName() const {
19471950 case DeclAttrKind::Extern:
19481951 return " _extern" ;
19491952 case DeclAttrKind::AllowFeatureSuppression:
1950- return " _allowFeatureSuppression" ;
1953+ if (cast<AllowFeatureSuppressionAttr>(this )->getInverted ()) {
1954+ return " _disallowFeatureSuppression" ;
1955+ } else {
1956+ return " _allowFeatureSuppression" ;
1957+ }
19511958 }
19521959 llvm_unreachable (" bad DeclAttrKind" );
19531960}
@@ -2932,24 +2939,24 @@ StorageRestrictionsAttr::getAccessesProperties(AccessorDecl *attachedTo) const {
29322939 {});
29332940}
29342941
2935- AllowFeatureSuppressionAttr::AllowFeatureSuppressionAttr (SourceLoc atLoc,
2936- SourceRange range ,
2937- bool implicit,
2938- ArrayRef<Identifier> features)
2939- : DeclAttribute(DeclAttrKind::AllowFeatureSuppression,
2940- atLoc, range, implicit) {
2942+ AllowFeatureSuppressionAttr::AllowFeatureSuppressionAttr (
2943+ SourceLoc atLoc, SourceRange range, bool implicit, bool inverted ,
2944+ ArrayRef<Identifier> features)
2945+ : DeclAttribute(DeclAttrKind::AllowFeatureSuppression, atLoc, range,
2946+ implicit) {
2947+ Bits. AllowFeatureSuppressionAttr . Inverted = inverted;
29412948 Bits.AllowFeatureSuppressionAttr .NumFeatures = features.size ();
29422949 std::uninitialized_copy (features.begin (), features.end (),
29432950 getTrailingObjects<Identifier>());
29442951}
29452952
2946- AllowFeatureSuppressionAttr *
2947- AllowFeatureSuppressionAttr::create (ASTContext &ctx, SourceLoc atLoc,
2948- SourceRange range, bool implicit,
2949- ArrayRef<Identifier> features) {
2953+ AllowFeatureSuppressionAttr *AllowFeatureSuppressionAttr::create (
2954+ ASTContext &ctx, SourceLoc atLoc, SourceRange range, bool implicit,
2955+ bool inverted, ArrayRef<Identifier> features) {
29502956 unsigned size = totalSizeToAlloc<Identifier>(features.size ());
29512957 auto *mem = ctx.Allocate (size, alignof (AllowFeatureSuppressionAttr));
2952- return new (mem) AllowFeatureSuppressionAttr (atLoc, range, implicit, features);
2958+ return new (mem)
2959+ AllowFeatureSuppressionAttr (atLoc, range, implicit, inverted, features);
29532960}
29542961
29552962void swift::simple_display (llvm::raw_ostream &out, const DeclAttribute *attr) {
0 commit comments