2012-04-06 18:12:22 +00:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
2007-10-04 00:22:33 +00:00
|
|
|
|
2007-09-22 00:01:35 +00:00
|
|
|
@interface MyClass1 @end
|
|
|
|
|
2014-03-11 17:10:51 +00:00
|
|
|
@protocol p1,p2,p3; // expected-note {{protocol 'p1' has no definition}} \
|
|
|
|
// expected-note {{protocol 'p2' has no definition}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface MyClass1 (Category1) <p1> // expected-warning {{cannot find protocol definition for 'p1'}} expected-note {{previous definition is here}}
|
2007-09-22 00:01:35 +00:00
|
|
|
@end
|
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface MyClass1 (Category1) // expected-warning {{duplicate definition of category 'Category1' on interface 'MyClass1'}}
|
2007-09-22 00:01:35 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface MyClass1 (Category3)
|
|
|
|
@end
|
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface MyClass1 (Category4) @end // expected-note {{previous definition is here}}
|
2007-09-22 00:01:35 +00:00
|
|
|
@interface MyClass1 (Category5) @end
|
|
|
|
@interface MyClass1 (Category6) @end
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface MyClass1 (Category7) @end // expected-note {{previous definition is here}}
|
|
|
|
@interface MyClass1 (Category8) @end // expected-note {{previous definition is here}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface MyClass1 (Category4) @end // expected-warning {{duplicate definition of category 'Category4' on interface 'MyClass1'}}
|
|
|
|
@interface MyClass1 (Category7) @end // expected-warning {{duplicate definition of category 'Category7' on interface 'MyClass1'}}
|
|
|
|
@interface MyClass1 (Category8) @end // expected-warning {{duplicate definition of category 'Category8' on interface 'MyClass1'}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
@protocol p3 @end
|
|
|
|
|
2008-07-26 03:47:43 +00:00
|
|
|
@interface MyClass1 (Category) <p2, p3> @end // expected-warning {{cannot find protocol definition for 'p2'}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2010-01-03 18:01:57 +00:00
|
|
|
@interface UnknownClass (Category) @end // expected-error {{cannot find interface declaration for 'UnknownClass'}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2011-11-14 22:10:01 +00:00
|
|
|
@class MyClass2; // expected-note{{forward declaration of class here}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2011-11-14 22:10:01 +00:00
|
|
|
@interface MyClass2 (Category) @end // expected-error {{cannot define category for undefined class 'MyClass2'}}
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2008-06-05 04:33:44 +00:00
|
|
|
@interface XCRemoteComputerManager
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface XCRemoteComputerManager()
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface XCRemoteComputerManager()
|
|
|
|
@end
|
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface XCRemoteComputerManager(x) // expected-note {{previous definition is here}}
|
2008-06-05 04:33:44 +00:00
|
|
|
@end
|
|
|
|
|
2008-11-23 22:38:38 +00:00
|
|
|
@interface XCRemoteComputerManager(x) // expected-warning {{duplicate definition of category 'x' on interface 'XCRemoteComputerManager'}}
|
2008-06-05 04:33:44 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation XCRemoteComputerManager
|
|
|
|
@end
|
|
|
|
|
2009-07-21 00:05:53 +00:00
|
|
|
@implementation XCRemoteComputerManager(x) // expected-note {{previous definition is here}}
|
|
|
|
@end
|
2007-09-22 00:01:35 +00:00
|
|
|
|
2009-07-21 00:05:53 +00:00
|
|
|
@implementation XCRemoteComputerManager(x) // expected-error {{reimplementation of category 'x' for class 'XCRemoteComputerManager'}}
|
|
|
|
@end
|
2009-09-29 18:51:43 +00:00
|
|
|
|
|
|
|
// <rdar://problem/7249233>
|
|
|
|
|
|
|
|
@protocol MultipleCat_P
|
2012-02-27 22:55:11 +00:00
|
|
|
-(void) im0; // expected-note {{method 'im0' declared here}}
|
2009-09-29 18:51:43 +00:00
|
|
|
@end
|
|
|
|
|
2013-12-13 05:58:51 +00:00
|
|
|
@interface MultipleCat_I @end
|
2009-09-29 18:51:43 +00:00
|
|
|
|
|
|
|
@interface MultipleCat_I() @end
|
|
|
|
|
|
|
|
@interface MultipleCat_I() <MultipleCat_P> @end
|
|
|
|
|
2013-12-13 05:58:51 +00:00
|
|
|
@implementation MultipleCat_I // expected-warning {{method 'im0' in protocol 'MultipleCat_P' not implemented}}
|
2009-09-29 18:51:43 +00:00
|
|
|
@end
|
2010-02-23 19:39:46 +00:00
|
|
|
|
|
|
|
// <rdar://problem/7680391> - Handle nameless categories with no name that refer
|
|
|
|
// to an undefined class
|
|
|
|
@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}}
|
2011-01-20 19:45:14 +00:00
|
|
|
|
|
|
|
// <rdar://problem/8891119> - Handle @synthesize being used in conjunction
|
|
|
|
// with explicitly declared accessor.
|
|
|
|
@interface RDar8891119 {
|
|
|
|
id _name;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
@interface RDar8891119 ()
|
|
|
|
- (id)name;
|
|
|
|
@end
|
|
|
|
@interface RDar8891119 ()
|
|
|
|
@property (copy) id name;
|
|
|
|
@end
|
|
|
|
@implementation RDar8891119
|
|
|
|
@synthesize name = _name;
|
|
|
|
@end
|
|
|
|
|
2012-03-02 19:14:29 +00:00
|
|
|
// rdar://10968158
|
|
|
|
@class I; // expected-note {{forward declaration}}
|
|
|
|
@implementation I(cat) // expected-error{{cannot find interface declaration}}
|
|
|
|
@end
|
2012-05-17 22:39:14 +00:00
|
|
|
|
|
|
|
// <rdar://problem/11478173>
|
|
|
|
@interface Unrelated
|
|
|
|
- foo;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface Blah (Blarg) // expected-error{{cannot find interface declaration for 'Blah'}}
|
|
|
|
- foo;
|
|
|
|
@end
|