1// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -verify %s 2// rdar://9092208 3 4__attribute__((unavailable("not available"))) 5@interface MyClass { // expected-note 8 {{'MyClass' has been explicitly marked unavailable here}} 6@public 7 void *_test; 8 MyClass *ivar; // no error. 9} 10 11- (id)self; 12- new; 13+ (void)addObject:(id)anObject; 14- (MyClass *)meth; // no error. 15 16@end 17 18@interface Gorf { 19 MyClass *ivar; // expected-error {{unavailable}} 20} 21- (MyClass *)meth; // expected-error {{unavailable}} 22@end 23 24@interface MyClass (Cat1) 25- (MyClass *)meth; // no error. 26@end 27 28@interface MyClass (Cat2) // no error. 29@end 30 31@implementation MyClass (Cat2) // expected-error {{unavailable}} 32@end 33 34int main() { 35 [MyClass new]; // expected-error {{'MyClass' is unavailable: not available}} 36 [MyClass self]; // expected-error {{'MyClass' is unavailable: not available}} 37 [MyClass addObject:((void *)0)]; // expected-error {{'MyClass' is unavailable: not available}} 38 39 MyClass *foo = [MyClass new]; // expected-error 2 {{'MyClass' is unavailable: not available}} 40 41 return 0; 42} 43 44// rdar://16681279 45@interface NSObject @end 46 47__attribute__((visibility("default"))) __attribute__((availability(macosx,unavailable))) 48@interface Foo : NSObject @end // expected-note 3 {{'Foo' has been explicitly marked unavailable here}} 49@interface AppDelegate : NSObject 50@end 51 52@class Foo; 53 54@implementation AppDelegate 55- (void) applicationDidFinishLaunching 56{ 57 Foo *foo = 0; // expected-error {{'Foo' is unavailable}} 58} 59@end 60 61@class Foo; 62Foo *g_foo = 0; // expected-error {{'Foo' is unavailable}} 63 64@class Foo; 65@class Foo; 66@class Foo; 67Foo * f_func() { // expected-error {{'Foo' is unavailable}} 68 return 0; 69} 70 71#define UNAVAILABLE __attribute__((unavailable("not available"))) 72 73UNAVAILABLE 74@interface Base // expected-note {{unavailable here}} 75@end 76 77UNAVAILABLE 78@protocol SomeProto // expected-note 4 {{unavailable here}} 79@end 80 81@interface Sub : Base<SomeProto> // expected-error 2 {{unavailable}} 82@end 83@interface IP<SomeProto> // expected-error {{unavailable}} 84@end 85@protocol SubProt<SomeProto> // expected-error {{unavailable}} 86@end 87@interface Sub(cat)<SomeProto> // expected-error {{unavailable}} 88@end 89 90UNAVAILABLE 91@interface UnavailSub : Base<SomeProto> // no error 92@end 93UNAVAILABLE 94@interface UnavailIP<SomeProto> // no error 95@end 96UNAVAILABLE 97@protocol UnavailProt<SomeProto> // no error 98@end 99@interface UnavailSub(cat)<SomeProto> // no error 100@end 101