Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 @interface MyClass1 @end
      4 
      5 @protocol p1,p2,p3;
      6 
      7 @interface MyClass1 (Category1)  <p1> // expected-warning {{cannot find protocol definition for 'p1'}} expected-note {{previous definition is here}}
      8 @end
      9 
     10 @interface MyClass1 (Category1)  // expected-warning {{duplicate definition of category 'Category1' on interface 'MyClass1'}}
     11 @end
     12 
     13 @interface MyClass1 (Category3) 
     14 @end
     15 
     16 @interface MyClass1 (Category4) @end // expected-note {{previous definition is here}}
     17 @interface MyClass1 (Category5) @end
     18 @interface MyClass1 (Category6) @end
     19 @interface MyClass1 (Category7) @end // expected-note {{previous definition is here}}
     20 @interface MyClass1 (Category8) @end // expected-note {{previous definition is here}}
     21 
     22 
     23 @interface MyClass1 (Category4) @end // expected-warning {{duplicate definition of category 'Category4' on interface 'MyClass1'}}
     24 @interface MyClass1 (Category7) @end // expected-warning {{duplicate definition of category 'Category7' on interface 'MyClass1'}}
     25 @interface MyClass1 (Category8) @end // expected-warning {{duplicate definition of category 'Category8' on interface 'MyClass1'}}
     26 
     27 
     28 @protocol p3 @end
     29 
     30 @interface MyClass1 (Category) <p2, p3> @end  // expected-warning {{cannot find protocol definition for 'p2'}}
     31 
     32 @interface UnknownClass  (Category) @end // expected-error {{cannot find interface declaration for 'UnknownClass'}}
     33 
     34 @class MyClass2;
     35 
     36 @interface MyClass2  (Category) @end  // expected-error {{cannot find interface declaration for 'MyClass2'}}
     37 
     38 @interface XCRemoteComputerManager
     39 @end
     40 
     41 @interface XCRemoteComputerManager() 
     42 @end 
     43 
     44 @interface XCRemoteComputerManager()
     45 @end
     46 
     47 @interface XCRemoteComputerManager(x) // expected-note {{previous definition is here}}
     48 @end 
     49 
     50 @interface XCRemoteComputerManager(x) // expected-warning {{duplicate definition of category 'x' on interface 'XCRemoteComputerManager'}}
     51 @end
     52 
     53 @implementation XCRemoteComputerManager
     54 @end
     55 
     56 @implementation XCRemoteComputerManager(x) // expected-note {{previous definition is here}}
     57 @end
     58 
     59 @implementation XCRemoteComputerManager(x) // expected-error {{reimplementation of category 'x' for class 'XCRemoteComputerManager'}}
     60 @end
     61 
     62 // <rdar://problem/7249233>
     63 
     64 @protocol MultipleCat_P
     65 -(void) im0; // expected-note {{method declared here}}
     66 @end
     67 
     68 @interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}}
     69 
     70 @interface MultipleCat_I()  @end
     71 
     72 @interface MultipleCat_I() <MultipleCat_P>  @end
     73 
     74 @implementation MultipleCat_I // expected-warning {{incomplete implementation}} \
     75                               // expected-warning {{method in protocol not implemented [-Wprotocol]}}
     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