1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2 3@interface MyClass1 @end 4 5@protocol p1,p2,p3; // expected-note {{protocol 'p1' has no definition}} \ 6 // expected-note {{protocol 'p2' has no definition}} 7 8@interface MyClass1 (Category1) <p1> // expected-warning {{cannot find protocol definition for 'p1'}} expected-note {{previous definition is here}} 9@end 10 11@interface MyClass1 (Category1) // expected-warning {{duplicate definition of category 'Category1' on interface 'MyClass1'}} 12@end 13 14@interface MyClass1 (Category3) 15@end 16 17@interface MyClass1 (Category4) @end // expected-note {{previous definition is here}} 18@interface MyClass1 (Category5) @end 19@interface MyClass1 (Category6) @end 20@interface MyClass1 (Category7) @end // expected-note {{previous definition is here}} 21@interface MyClass1 (Category8) @end // expected-note {{previous definition is here}} 22 23 24@interface MyClass1 (Category4) @end // expected-warning {{duplicate definition of category 'Category4' on interface 'MyClass1'}} 25@interface MyClass1 (Category7) @end // expected-warning {{duplicate definition of category 'Category7' on interface 'MyClass1'}} 26@interface MyClass1 (Category8) @end // expected-warning {{duplicate definition of category 'Category8' on interface 'MyClass1'}} 27 28 29@protocol p3 @end 30 31@interface MyClass1 (Category) <p2, p3> @end // expected-warning {{cannot find protocol definition for 'p2'}} 32 33@interface UnknownClass (Category) @end // expected-error {{cannot find interface declaration for 'UnknownClass'}} 34 35@class MyClass2; // expected-note{{forward declaration of class here}} 36 37@interface MyClass2 (Category) @end // expected-error {{cannot define category for undefined class 'MyClass2'}} 38 39@interface XCRemoteComputerManager 40@end 41 42@interface XCRemoteComputerManager() 43@end 44 45@interface XCRemoteComputerManager() 46@end 47 48@interface XCRemoteComputerManager(x) // expected-note {{previous definition is here}} 49@end 50 51@interface XCRemoteComputerManager(x) // expected-warning {{duplicate definition of category 'x' on interface 'XCRemoteComputerManager'}} 52@end 53 54@implementation XCRemoteComputerManager 55@end 56 57@implementation XCRemoteComputerManager(x) // expected-note {{previous definition is here}} 58@end 59 60@implementation XCRemoteComputerManager(x) // expected-error {{reimplementation of category 'x' for class 'XCRemoteComputerManager'}} 61@end 62 63@protocol MultipleCat_P 64-(void) im0; // expected-note {{method 'im0' declared here}} 65@end 66 67@interface MultipleCat_I @end 68 69@interface MultipleCat_I() @end 70 71@interface MultipleCat_I() <MultipleCat_P> @end 72 73@implementation MultipleCat_I // expected-warning {{method 'im0' in protocol 'MultipleCat_P' not implemented}} 74@end 75 76// Handle nameless categories with no name that refer to an undefined class. 77@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}} 78 79// Handle @synthesize being used in conjunction with explicitly declared 80// accessor. 81@interface RDar8891119 { 82 id _name; 83} 84@end 85@interface RDar8891119 () 86- (id)name; 87@end 88@interface RDar8891119 () 89@property (copy) id name; 90@end 91@implementation RDar8891119 92@synthesize name = _name; 93@end 94 95@class I; // expected-note {{forward declaration}} 96@implementation I(cat) // expected-error{{cannot find interface declaration}} 97@end 98 99@interface Unrelated 100- foo; 101@end 102 103@interface Blah (Blarg) // expected-error{{cannot find interface declaration for 'Blah'}} 104- foo; 105@end 106