1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2*0a6a1f1dSLionel Sambuc// rdar://16462586 3*0a6a1f1dSLionel Sambuc 4*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name)) // expected-error {{'objc_runtime_name' attribute takes one argument}} 5*0a6a1f1dSLionel Sambuc@interface BInterface 6*0a6a1f1dSLionel Sambuc@end 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name(123))) // expected-error {{'objc_runtime_name' attribute requires a string}} 9*0a6a1f1dSLionel Sambuc@protocol BProtocol1 10*0a6a1f1dSLionel Sambuc@end 11*0a6a1f1dSLionel Sambuc 12*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Protocol"))) 13*0a6a1f1dSLionel Sambuc@protocol Protocol 14*0a6a1f1dSLionel Sambuc@end 15*0a6a1f1dSLionel Sambuc 16*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message"))) 17*0a6a1f1dSLionel Sambuc@interface Message <Protocol> { 18*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} 19*0a6a1f1dSLionel Sambuc id MyIVAR; 20*0a6a1f1dSLionel Sambuc} 21*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message"))) 22*0a6a1f1dSLionel Sambuc@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface or protocol}}}} 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambuc- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} 25*0a6a1f1dSLionel Sambuc 26*0a6a1f1dSLionel Sambuc- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} 27*0a6a1f1dSLionel Sambuc 28*0a6a1f1dSLionel Sambuc@end 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.ForwardClass"))) 31*0a6a1f1dSLionel Sambuc@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface or protocol}} 32*0a6a1f1dSLionel Sambuc 33*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol"))) 34*0a6a1f1dSLionel Sambuc@protocol ForwardProtocol; 35*0a6a1f1dSLionel Sambuc 36*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message"))) 37*0a6a1f1dSLionel Sambuc@implementation Message // expected-error {{prefix attribute must be followed by an interface or protocol}} 38*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message"))) 39*0a6a1f1dSLionel Sambuc- (id) MyMethod { 40*0a6a1f1dSLionel Sambuc return MyIVAR; 41*0a6a1f1dSLionel Sambuc} 42*0a6a1f1dSLionel Sambuc@end 43