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// <rdar://problem/7249233> 64 65@protocol MultipleCat_P 66-(void) im0; // expected-note {{method 'im0' declared here}} 67@end 68 69@interface MultipleCat_I @end 70 71@interface MultipleCat_I() @end 72 73@interface MultipleCat_I() <MultipleCat_P> @end 74 75@implementation MultipleCat_I // expected-warning {{method 'im0' in protocol 'MultipleCat_P' not implemented}} 76@end 77 78// <rdar://problem/7680391> - Handle nameless categories with no name that refer 79// to an undefined class 80@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}} 81 82// <rdar://problem/8891119> - Handle @synthesize being used in conjunction 83// with explicitly declared accessor. 84@interface RDar8891119 { 85 id _name; 86} 87@end 88@interface RDar8891119 () 89- (id)name; 90@end 91@interface RDar8891119 () 92@property (copy) id name; 93@end 94@implementation RDar8891119 95@synthesize name = _name; 96@end 97 98// rdar://10968158 99@class I; // expected-note {{forward declaration}} 100@implementation I(cat) // expected-error{{cannot find interface declaration}} 101@end 102 103// <rdar://problem/11478173> 104@interface Unrelated 105- foo; 106@end 107 108@interface Blah (Blarg) // expected-error{{cannot find interface declaration for 'Blah'}} 109- foo; 110@end 111