Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
      2 
      3 @interface X1
      4 @end
      5 @implementation X1 // expected-note {{implementation started here}}
      6 @interface Y1 // expected-error {{missing '@end'}}
      7 @end
      8 @end // expected-error {{'@end' must appear in an Objective-C context}}
      9 
     10 @interface X2
     11 @end
     12 @implementation X2 // expected-note {{implementation started here}}
     13 @protocol Y2 // expected-error {{missing '@end'}}
     14 @end
     15 @end // expected-error {{'@end' must appear in an Objective-C context}}
     16 
     17 @interface X6 // expected-note {{class started here}}
     18 @interface X7 // expected-error {{missing '@end'}}
     19 @end
     20 @end // expected-error {{'@end' must appear in an Objective-C context}}
     21 
     22 @protocol P1 // expected-note {{protocol started here}}
     23 @interface P2 // expected-error {{missing '@end'}}
     24 @end
     25 @end // expected-error {{'@end' must appear in an Objective-C context}}
     26 
     27 @interface X4 // expected-note {{class started here}}
     28 @implementation X4 // expected-error {{missing '@end'}}
     29 @end
     30 @end // expected-error {{'@end' must appear in an Objective-C context}}
     31 
     32 @interface I
     33 @end
     34 @implementation I
     35 @protocol P; // forward declarations of protocols in @implementations is allowed
     36 @class C; // forward declarations of classes in @implementations is allowed
     37 - (C<P>*) MyMeth {}
     38 @end
     39 
     40 @interface I2 {}
     41 @protocol P2; // expected-error {{illegal interface qualifier}}
     42 @class C2; // expected-error {{illegal interface qualifier}}
     43 @end
     44 
     45 @interface I3
     46 @end
     47 @implementation I3
     48 - Meth {}
     49 + Cls {}
     50 @protocol P3;
     51 @end
     52