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