brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · aa2114d Raw
50 lines · plain
1// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s2 3__attribute__((objc_runtime_name)) // expected-error {{'objc_runtime_name' attribute takes one argument}}4@interface BInterface5@end6 7__attribute__((objc_runtime_name(123))) // expected-error {{expected string literal as argument of 'objc_runtime_name' attribute}}8@protocol BProtocol19@end10 11__attribute__((objc_runtime_name("MySecretNamespace.Protocol")))12@protocol Protocol13@end14 15__attribute__((objc_runtime_name("MySecretNamespace.Message")))16@interface Message <Protocol> {17__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}18  id MyIVAR;19}20__attribute__((objc_runtime_name("MySecretNamespace.Message")))21@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}}}22 23- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}24 25- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to}}26 27@end28 29__attribute__((objc_runtime_name("MySecretNamespace.ForwardClass")))30@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}31 32__attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol")))33@protocol ForwardProtocol;34 35@implementation Message36// expected-error@+1 {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}37- (id) MyMethod __attribute__((objc_runtime_name("MySecretNamespace.Message"))) {38  return MyIVAR;39}40 41-(int)getMyProperty { return 0; }42-(void)setMyProperty:(int)arg {}43@end44 45@interface NoImpl @end46 47// expected-error@+1 {{'objc_runtime_name' attribute only applies to Objective-C interfaces and Objective-C protocols}}48__attribute__((objc_runtime_name("MySecretNamespace.Message")))49@implementation NoImpl @end50