@@ -1688,43 +1688,41 @@ class DeclAndTypePrinter::Implementation
1688
1688
hasPrintedAnything = true ;
1689
1689
};
1690
1690
1691
- for (auto semanticAttr : D->getSemanticAvailableAttrs ()) {
1692
- auto AvAttr = semanticAttr.getParsedAttr ();
1693
-
1694
- if (AvAttr->getPlatform () == PlatformKind::none) {
1695
- if (AvAttr->getPlatformAgnosticAvailability () ==
1696
- PlatformAgnosticAvailabilityKind::Unavailable) {
1691
+ for (auto AvAttr : D->getSemanticAvailableAttrs ()) {
1692
+ if (AvAttr.getPlatform () == PlatformKind::none) {
1693
+ if (AvAttr.isUnconditionallyUnavailable () &&
1694
+ !AvAttr.getDomain ().isSwiftLanguage ()) {
1697
1695
// Availability for *
1698
- if (!AvAttr-> Rename .empty () && isa<ValueDecl>(D)) {
1696
+ if (!AvAttr. getRename () .empty () && isa<ValueDecl>(D)) {
1699
1697
// rename
1700
1698
maybePrintLeadingSpace ();
1701
1699
os << " SWIFT_UNAVAILABLE_MSG(\" '"
1702
1700
<< cast<ValueDecl>(D)->getBaseName ()
1703
1701
<< " ' has been renamed to '" ;
1704
1702
printRenameForDecl (os, AvAttr, cast<ValueDecl>(D), false );
1705
1703
os << ' \' ' ;
1706
- if (!AvAttr-> Message .empty ()) {
1704
+ if (!AvAttr. getMessage () .empty ()) {
1707
1705
os << " : " ;
1708
- printEncodedString (os, AvAttr-> Message , false );
1706
+ printEncodedString (os, AvAttr. getMessage () , false );
1709
1707
}
1710
1708
os << " \" )" ;
1711
- } else if (!AvAttr-> Message .empty ()) {
1709
+ } else if (!AvAttr. getMessage () .empty ()) {
1712
1710
maybePrintLeadingSpace ();
1713
1711
os << " SWIFT_UNAVAILABLE_MSG(" ;
1714
- printEncodedString (os, AvAttr-> Message );
1712
+ printEncodedString (os, AvAttr. getMessage () );
1715
1713
os << " )" ;
1716
1714
} else {
1717
1715
maybePrintLeadingSpace ();
1718
1716
os << " SWIFT_UNAVAILABLE" ;
1719
1717
}
1720
1718
break ;
1721
1719
}
1722
- if (AvAttr-> isUnconditionallyDeprecated ()) {
1723
- if (!AvAttr-> Rename . empty () || !AvAttr-> Message .empty ()) {
1720
+ if (AvAttr. isUnconditionallyDeprecated ()) {
1721
+ if (!AvAttr. getRename (). empty () || !AvAttr. getMessage () .empty ()) {
1724
1722
maybePrintLeadingSpace ();
1725
1723
os << " SWIFT_DEPRECATED_MSG(" ;
1726
- printEncodedString (os, AvAttr-> Message );
1727
- if (!AvAttr-> Rename .empty ()) {
1724
+ printEncodedString (os, AvAttr. getMessage () );
1725
+ if (!AvAttr. getRename () .empty ()) {
1728
1726
os << " , " ;
1729
1727
printRenameForDecl (os, AvAttr, cast<ValueDecl>(D), true );
1730
1728
}
@@ -1738,15 +1736,16 @@ class DeclAndTypePrinter::Implementation
1738
1736
}
1739
1737
1740
1738
// Availability for a specific platform
1741
- if (!AvAttr->Introduced .has_value () && !AvAttr->Deprecated .has_value () &&
1742
- !AvAttr->Obsoleted .has_value () &&
1743
- !AvAttr->isUnconditionallyDeprecated () &&
1744
- !AvAttr->isUnconditionallyUnavailable ()) {
1739
+ if (!AvAttr.getIntroduced ().has_value () &&
1740
+ !AvAttr.getDeprecated ().has_value () &&
1741
+ !AvAttr.getObsoleted ().has_value () &&
1742
+ !AvAttr.isUnconditionallyDeprecated () &&
1743
+ !AvAttr.isUnconditionallyUnavailable ()) {
1745
1744
continue ;
1746
1745
}
1747
1746
1748
1747
const char *plat;
1749
- switch (AvAttr-> getPlatform ()) {
1748
+ switch (AvAttr. getPlatform ()) {
1750
1749
case PlatformKind::macOS:
1751
1750
plat = " macos" ;
1752
1751
break ;
@@ -1795,52 +1794,53 @@ class DeclAndTypePrinter::Implementation
1795
1794
1796
1795
maybePrintLeadingSpace ();
1797
1796
os << " SWIFT_AVAILABILITY(" << plat;
1798
- if (AvAttr-> isUnconditionallyUnavailable ()) {
1797
+ if (AvAttr. isUnconditionallyUnavailable ()) {
1799
1798
os << " ,unavailable" ;
1800
1799
} else {
1801
- if (AvAttr-> Introduced .has_value ()) {
1802
- os << " ,introduced=" << AvAttr-> Introduced .value ().getAsString ();
1800
+ if (AvAttr. getIntroduced () .has_value ()) {
1801
+ os << " ,introduced=" << AvAttr. getIntroduced () .value ().getAsString ();
1803
1802
}
1804
- if (AvAttr-> Deprecated .has_value ()) {
1805
- os << " ,deprecated=" << AvAttr-> Deprecated .value ().getAsString ();
1806
- } else if (AvAttr-> isUnconditionallyDeprecated ()) {
1803
+ if (AvAttr. getDeprecated () .has_value ()) {
1804
+ os << " ,deprecated=" << AvAttr. getDeprecated () .value ().getAsString ();
1805
+ } else if (AvAttr. isUnconditionallyDeprecated ()) {
1807
1806
// We need to specify some version, we can't just say deprecated.
1808
1807
// We also can't deprecate it before it's introduced.
1809
- if (AvAttr->Introduced .has_value ()) {
1810
- os << " ,deprecated=" << AvAttr->Introduced .value ().getAsString ();
1808
+ if (AvAttr.getIntroduced ().has_value ()) {
1809
+ os << " ,deprecated="
1810
+ << AvAttr.getIntroduced ().value ().getAsString ();
1811
1811
} else {
1812
1812
os << " ,deprecated=0.0.1" ;
1813
1813
}
1814
1814
}
1815
- if (AvAttr-> Obsoleted .has_value ()) {
1816
- os << " ,obsoleted=" << AvAttr-> Obsoleted .value ().getAsString ();
1815
+ if (AvAttr. getObsoleted () .has_value ()) {
1816
+ os << " ,obsoleted=" << AvAttr. getObsoleted () .value ().getAsString ();
1817
1817
}
1818
1818
}
1819
- if (!AvAttr-> Rename .empty () && isa<ValueDecl>(D)) {
1819
+ if (!AvAttr. getRename () .empty () && isa<ValueDecl>(D)) {
1820
1820
os << " ,message=\" '" << cast<ValueDecl>(D)->getBaseName ()
1821
1821
<< " ' has been renamed to '" ;
1822
1822
printRenameForDecl (os, AvAttr, cast<ValueDecl>(D), false );
1823
1823
os << ' \' ' ;
1824
- if (!AvAttr-> Message .empty ()) {
1824
+ if (!AvAttr. getMessage () .empty ()) {
1825
1825
os << " : " ;
1826
- printEncodedString (os, AvAttr-> Message , false );
1826
+ printEncodedString (os, AvAttr. getMessage () , false );
1827
1827
}
1828
1828
os << " \" " ;
1829
- } else if (!AvAttr-> Message .empty ()) {
1829
+ } else if (!AvAttr. getMessage () .empty ()) {
1830
1830
os << " ,message=" ;
1831
- printEncodedString (os, AvAttr-> Message );
1831
+ printEncodedString (os, AvAttr. getMessage () );
1832
1832
}
1833
1833
os << " )" ;
1834
1834
}
1835
1835
return hasPrintedAnything;
1836
1836
}
1837
1837
1838
1838
private:
1839
- void printRenameForDecl (raw_ostream &os, const AvailableAttr * AvAttr,
1839
+ void printRenameForDecl (raw_ostream &os, SemanticAvailableAttr AvAttr,
1840
1840
const ValueDecl *D, bool includeQuotes) {
1841
- assert (!AvAttr-> Rename .empty ());
1841
+ assert (!AvAttr. getRename () .empty ());
1842
1842
1843
- auto *renamedDecl = D->getRenamedDecl (AvAttr);
1843
+ auto *renamedDecl = D->getRenamedDecl (AvAttr. getParsedAttr () );
1844
1844
if (renamedDecl) {
1845
1845
assert (shouldInclude (renamedDecl) &&
1846
1846
" ObjC printer logic mismatch with renamed decl" );
@@ -1849,7 +1849,7 @@ class DeclAndTypePrinter::Implementation
1849
1849
renamedDecl->getObjCRuntimeName ()->getString (scratch);
1850
1850
printEncodedString (os, renamedObjCRuntimeName, includeQuotes);
1851
1851
} else {
1852
- printEncodedString (os, AvAttr-> Rename , includeQuotes);
1852
+ printEncodedString (os, AvAttr. getRename () , includeQuotes);
1853
1853
}
1854
1854
}
1855
1855
0 commit comments