brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 3dcf89d Raw
65 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-protocol-method-implementation %s2 3__attribute__((objc_root_class))4@interface A5@end6 7@interface A (Cat)8- (void)A_Cat __attribute__((objc_direct)); // expected-note {{previous declaration is here}}9@end10 11@implementation A12- (void)A_Cat { // expected-error {{direct method was declared in a category but is implemented in the primary interface}}13}14@end15 16__attribute__((objc_root_class))17@interface B18- (void)B_primary __attribute__((objc_direct)); // expected-note {{previous declaration is here}}19@end20 21@interface B ()22- (void)B_extension __attribute__((objc_direct)); // expected-note {{previous declaration is here}}23@end24 25@interface B (Cat)26- (void)B_Cat __attribute__((objc_direct));27@end28 29@interface B (OtherCat)30- (void)B_OtherCat __attribute__((objc_direct)); // expected-note {{previous declaration is here}}31@end32 33@implementation B34- (void)B_primary {35}36- (void)B_extension {37}38- (void)B_implOnly __attribute__((objc_direct)) { // expected-note {{previous declaration is here}}39}40@end41 42@implementation B (Cat)43- (void)B_primary { // expected-error {{direct method was declared in the primary interface but is implemented in a category}}44}45- (void)B_extension { // expected-error {{direct method was declared in an extension but is implemented in a different category}}46}47- (void)B_Cat {48}49- (void)B_OtherCat { // expected-error {{direct method was declared in a category but is implemented in a different category}}50}51- (void)B_implOnly __attribute__((objc_direct)) { // expected-error {{direct method declaration conflicts with previous direct declaration of method 'B_implOnly'}}52}53@end54 55__attribute__((objc_root_class))56@interface C57- (void)C1 __attribute__((objc_direct)); // expected-note {{previous declaration is here}}58- (void)C2;                              // expected-note {{previous declaration is here}}59@end60 61@interface C (Cat)62- (void)C1;                              // expected-error {{method declaration conflicts with previous direct declaration of method 'C1'}}63- (void)C2 __attribute__((objc_direct)); // expected-error {{direct method declaration conflicts with previous declaration of method 'C2'}}64@end65