Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
      2 
      3 @interface StopAtAtEnd
      4 // This used to eat the @end
      5 int 123 // expected-error{{expected unqualified-id}}
      6 @end
      7 
      8 @implementation StopAtAtEnd // no-warning
      9 int 123 // expected-error{{expected unqualified-id}}
     10 @end
     11 
     12 
     13 @interface StopAtMethodDecls
     14 // This used to eat the method declarations
     15 int 123 // expected-error{{expected unqualified-id}}
     16 - (void)foo; // expected-note{{here}}
     17 int 456 // expected-error{{expected unqualified-id}}
     18 + (void)bar; // expected-note{{here}}
     19 @end
     20 
     21 @implementation StopAtMethodDecls
     22 int 123 // expected-error{{expected unqualified-id}}
     23 - (id)foo {} // expected-warning{{conflicting return type}}
     24 int 456 // expected-error{{expected unqualified-id}}
     25 + (id)bar {} // expected-warning{{conflicting return type}}
     26 @end
     27 
     28 
     29 @interface EmbeddedNamespace
     30 // This used to cause an infinite loop.
     31 namespace NS { // expected-error{{expected unqualified-id}}
     32 }
     33 - (id)test; // expected-note{{here}}
     34 @end
     35 
     36 @implementation EmbeddedNamespace
     37 int 123 // expected-error{{expected unqualified-id}}
     38 // We should still stop here and parse this namespace.
     39 namespace NS {
     40   void foo();
     41 }
     42 
     43 // Make sure the declaration of -test was recognized.
     44 - (void)test { // expected-warning{{conflicting return type}}
     45   // Make sure the declaration of NS::foo was recognized.
     46   NS::foo();
     47 }
     48 
     49 @end
     50 
     51 
     52 @protocol ProtocolWithEmbeddedNamespace
     53 namespace NS { // expected-error{{expected unqualified-id}}
     54 
     55 }
     56 - (void)PWEN_foo; // expected-note{{here}}
     57 @end
     58 
     59 @interface ImplementPWEN <ProtocolWithEmbeddedNamespace>
     60 @end
     61 
     62 @implementation ImplementPWEN
     63 - (id)PWEN_foo {} // expected-warning{{conflicting return type}}
     64 @end
     65