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