diff options
Diffstat (limited to 'test/Parser/objc-recover.mm')
-rw-r--r-- | test/Parser/objc-recover.mm | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/Parser/objc-recover.mm b/test/Parser/objc-recover.mm new file mode 100644 index 0000000..61444c7 --- /dev/null +++ b/test/Parser/objc-recover.mm @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s + +@interface StopAtAtEnd +// This used to eat the @end +int 123 // expected-error{{expected unqualified-id}} +@end + +@implementation StopAtAtEnd // no-warning +int 123 // expected-error{{expected unqualified-id}} +@end + + +@interface StopAtMethodDecls +// This used to eat the method declarations +int 123 // expected-error{{expected unqualified-id}} +- (void)foo; // expected-note{{here}} +int 456 // expected-error{{expected unqualified-id}} ++ (void)bar; // expected-note{{here}} +@end + +@implementation StopAtMethodDecls +int 123 // expected-error{{expected unqualified-id}} +- (id)foo {} // expected-warning{{conflicting return type}} +int 456 // expected-error{{expected unqualified-id}} ++ (id)bar {} // expected-warning{{conflicting return type}} +@end + + +@interface EmbeddedNamespace +// This used to cause an infinite loop. +namespace NS { // expected-error{{expected unqualified-id}} +} +- (id)test; // expected-note{{here}} +@end + +@implementation EmbeddedNamespace +int 123 // expected-error{{expected unqualified-id}} +// We should still stop here and parse this namespace. +namespace NS { + void foo(); +} + +// Make sure the declaration of -test was recognized. +- (void)test { // expected-warning{{conflicting return type}} + // Make sure the declaration of NS::foo was recognized. + NS::foo(); +} + +@end + + +@protocol ProtocolWithEmbeddedNamespace +namespace NS { // expected-error{{expected unqualified-id}} + +} +- (void)PWEN_foo; // expected-note{{here}} +@end + +@interface ImplementPWEN <ProtocolWithEmbeddedNamespace> +@end + +@implementation ImplementPWEN +- (id)PWEN_foo {} // expected-warning{{conflicting return type}} +@end |