forked from OSchip/llvm-project
Patch for small addition to availability attribute.
This is to accept "NA" in place of vesion number for availability attribute. Used on introduced=NA to mean unavailable and deprecated=NA to mean nothing (not deprecated). rdar://18804883 llvm-svn: 221417
This commit is contained in:
parent
81eed943a3
commit
5a29e6aadb
|
@ -870,6 +870,19 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
|
|||
break;
|
||||
}
|
||||
|
||||
// Special handling of 'NA' only when applied to introduced or
|
||||
// deprecated.
|
||||
if ((Keyword == Ident_introduced || Keyword == Ident_deprecated) &&
|
||||
Tok.is(tok::identifier)) {
|
||||
IdentifierInfo *NA = Tok.getIdentifierInfo();
|
||||
if (NA->getName() == "NA") {
|
||||
ConsumeToken();
|
||||
if (Keyword == Ident_introduced)
|
||||
UnavailableLoc = KeywordLoc;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SourceRange VersionRange;
|
||||
VersionTuple Version = ParseVersionTuple(VersionRange);
|
||||
|
||||
|
|
|
@ -95,3 +95,22 @@ id NSNibOwner, topNibObjects;
|
|||
- (void)Meth1 __attribute__((availability(macosx,introduced=10.3_0))); // expected-warning {{use same version number separators '_' or '.'}}
|
||||
- (void)Meth2 __attribute__((availability(macosx,introduced=10_3.1))); // expected-warning {{use same version number separators '_' or '.'}}
|
||||
@end
|
||||
|
||||
// rdar://18804883
|
||||
@protocol P18804883
|
||||
- (void)proto_method __attribute__((availability(macosx,introduced=10_1,deprecated=NA))); // means nothing (not deprecated)
|
||||
@end
|
||||
|
||||
@interface A18804883 <P18804883>
|
||||
- (void)interface_method __attribute__((availability(macosx,introduced=NA))); // expected-note {{'interface_method' has been explicitly marked unavailable here}}
|
||||
- (void)strange_method __attribute__((availability(macosx,introduced=NA,deprecated=NA))); // expected-note {{'strange_method' has been explicitly marked unavailable here}}
|
||||
- (void) always_available __attribute__((availability(macosx,deprecated=NA)));
|
||||
@end
|
||||
|
||||
void foo (A18804883* pa) {
|
||||
[pa interface_method]; // expected-error {{'interface_method' is unavailable: not available on OS X}}
|
||||
[pa proto_method];
|
||||
[pa strange_method]; // expected-error {{'strange_method' is unavailable: not available on OS X}}
|
||||
[pa always_available];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue