diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaObjC/category-1.m | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaObjC/category-1.m')
-rw-r--r-- | clang/test/SemaObjC/category-1.m | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/category-1.m b/clang/test/SemaObjC/category-1.m new file mode 100644 index 0000000..f842278 --- /dev/null +++ b/clang/test/SemaObjC/category-1.m @@ -0,0 +1,101 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s + +@interface MyClass1 @end + +@protocol p1,p2,p3; + +@interface MyClass1 (Category1) <p1> // expected-warning {{cannot find protocol definition for 'p1'}} expected-note {{previous definition is here}} +@end + +@interface MyClass1 (Category1) // expected-warning {{duplicate definition of category 'Category1' on interface 'MyClass1'}} +@end + +@interface MyClass1 (Category3) +@end + +@interface MyClass1 (Category4) @end // expected-note {{previous definition is here}} +@interface MyClass1 (Category5) @end +@interface MyClass1 (Category6) @end +@interface MyClass1 (Category7) @end // expected-note {{previous definition is here}} +@interface MyClass1 (Category8) @end // expected-note {{previous definition is here}} + + +@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'}} + + +@protocol p3 @end + +@interface MyClass1 (Category) <p2, p3> @end // expected-warning {{cannot find protocol definition for 'p2'}} + +@interface UnknownClass (Category) @end // expected-error {{cannot find interface declaration for 'UnknownClass'}} + +@class MyClass2; // expected-note{{forward declaration of class here}} + +@interface MyClass2 (Category) @end // expected-error {{cannot define category for undefined class 'MyClass2'}} + +@interface XCRemoteComputerManager +@end + +@interface XCRemoteComputerManager() +@end + +@interface XCRemoteComputerManager() +@end + +@interface XCRemoteComputerManager(x) // expected-note {{previous definition is here}} +@end + +@interface XCRemoteComputerManager(x) // expected-warning {{duplicate definition of category 'x' on interface 'XCRemoteComputerManager'}} +@end + +@implementation XCRemoteComputerManager +@end + +@implementation XCRemoteComputerManager(x) // expected-note {{previous definition is here}} +@end + +@implementation XCRemoteComputerManager(x) // expected-error {{reimplementation of category 'x' for class 'XCRemoteComputerManager'}} +@end + +// <rdar://problem/7249233> + +@protocol MultipleCat_P +-(void) im0; // expected-note {{method 'im0' declared here}} +@end + +@interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}} + +@interface MultipleCat_I() @end + +@interface MultipleCat_I() <MultipleCat_P> @end + +@implementation MultipleCat_I // expected-warning {{incomplete implementation}} \ + // expected-warning {{method 'im0' in protocol not implemented}} +@end + +// <rdar://problem/7680391> - Handle nameless categories with no name that refer +// to an undefined class +@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}} + +// <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 + +// rdar://10968158 +@class I; // expected-note {{forward declaration}} +@implementation I(cat) // expected-error{{cannot find interface declaration}} +@end |