// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify %s
-void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
+void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0))); // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}
void f2() __attribute__((availability(ios,introduced=2.1,deprecated=2.1)));
ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{function has been explicitly marked unavailable here}}
void test_10095131() {
- ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in Mac OS X 9.0 - use CTFontCopyFullName}}
- ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in Mac OS X 9.0 - use ATSFontGetFullPostScriptName}}
+ ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in OS X 9.0 - use CTFontCopyFullName}}
+ ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in OS X 9.0 - use ATSFontGetFullPostScriptName}}
}
// rdar://10711037
if (DI->ThisDecl->hasAttrs()) {
const AttrVec &Attrs = DI->ThisDecl->getAttrs();
- for (unsigned i = 0, e = Attrs.size(); i != e;) {
- const AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attrs[i++]);
+ for (unsigned i = 0, e = Attrs.size(); i != e; i++) {
+ const AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attrs[i]);
if (!AA)
continue;
- // availability attribute info.
-
+
+ // 'availability' attribute.
Result << "<Availability";
- StringRef distribution;
+ StringRef Distribution;
if (AA->getPlatform()) {
- distribution = AA->getPlatform()->getName();
- if (distribution == "macosx")
- distribution = "OSX";
- else
- distribution = "iOS";
+ Distribution = AvailabilityAttr::getPrettyPlatformName(
+ AA->getPlatform()->getName());
+ if (Distribution.empty())
+ Distribution = AA->getPlatform()->getName();
}
-
- Result << " distribution=\"";
- Result << distribution;
- Result << "\">";
+ Result << " distribution=\"" << Distribution << "\">";
VersionTuple IntroducedInVersion = AA->getIntroduced();
if (!IntroducedInVersion.empty()) {
- Result << " <IntroducedInVersion>";
- Result << IntroducedInVersion.getAsString();
- Result << "</IntroducedInVersion>";
+ Result << "<IntroducedInVersion>"
+ << IntroducedInVersion.getAsString()
+ << "</IntroducedInVersion>";
}
VersionTuple DeprecatedInVersion = AA->getDeprecated();
if (!DeprecatedInVersion.empty()) {
- Result << " <DeprecatedInVersion>";
- Result << DeprecatedInVersion.getAsString();
- Result << "</DeprecatedInVersion>";
+ Result << "<DeprecatedInVersion>"
+ << DeprecatedInVersion.getAsString()
+ << "</DeprecatedInVersion>";
}
VersionTuple RemovedAfterVersion = AA->getObsoleted();
if (!RemovedAfterVersion.empty()) {
- Result << " <RemovedAfterVersion>";
- Result << RemovedAfterVersion.getAsString();
- Result << "</RemovedAfterVersion>";
+ Result << "<RemovedAfterVersion>"
+ << RemovedAfterVersion.getAsString()
+ << "</RemovedAfterVersion>";
}
+ // 'deprecated' attribute.
StringRef DeprecationSummary = AA->getMessage();
if (!DeprecationSummary.empty()) {
- Result << " <DeprecationSummary>";
- Result << DeprecationSummary;
- Result << "</DeprecationSummary>";
+ Result << " <DeprecationSummary>"
+ << DeprecationSummary
+ << "</DeprecationSummary>";
}
- Result << " <Unavailable>";
+ // 'unavailable' attribute.
if (AA->getUnavailable())
- Result << "true";
- else
- Result << "false";
- Result << "</Unavailable>";
- Result << " </Availability>";
+ Result << "<Unavailable>true</Unavailable>";
+ Result << "</Availability>";
}
}
-
+
{
bool StartTagEmitted = false;
for (unsigned i = 0, e = Parts.MiscBlocks.size(); i != e; ++i) {