brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 4fe46dd Raw
106 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface MyClass1 @end4 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@end10 11@interface MyClass1 (Category1)  // expected-warning {{duplicate definition of category 'Category1' on interface 'MyClass1'}}12@end13 14@interface MyClass1 (Category3) 15@end16 17@interface MyClass1 (Category4) @end // expected-note {{previous definition is here}}18@interface MyClass1 (Category5) @end19@interface MyClass1 (Category6) @end20@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 @end30 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 XCRemoteComputerManager40@end41 42@interface XCRemoteComputerManager() 43@end 44 45@interface XCRemoteComputerManager()46@end47 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@end53 54@implementation XCRemoteComputerManager55@end56 57@implementation XCRemoteComputerManager(x) // expected-note {{previous definition is here}}58@end59 60@implementation XCRemoteComputerManager(x) // expected-error {{reimplementation of category 'x' for class 'XCRemoteComputerManager'}}61@end62 63@protocol MultipleCat_P64-(void) im0; // expected-note {{method 'im0' declared here}}65@end66 67@interface MultipleCat_I @end68 69@interface MultipleCat_I()  @end70 71@interface MultipleCat_I() <MultipleCat_P>  @end72 73@implementation MultipleCat_I // expected-warning {{method 'im0' in protocol 'MultipleCat_P' not implemented}}74@end75 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 declared80// accessor.81@interface RDar8891119 {82  id _name;83}84@end85@interface RDar8891119 ()86- (id)name;87@end88@interface RDar8891119 ()89@property (copy) id name;90@end91@implementation RDar889111992@synthesize name = _name;93@end94 95@class I; // expected-note {{forward declaration}}96@implementation I(cat) // expected-error{{cannot find interface declaration}}97@end98 99@interface Unrelated100- foo;101@end102 103@interface Blah (Blarg) // expected-error{{cannot find interface declaration for 'Blah'}}104- foo;105@end106