summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-02-23 00:11:21 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-02-23 00:11:21 +0000
commit82ff1e52dff0ba7ce432433938799e0f3eabd45d (patch)
tree97c4a95229d80ebd8a7ccf517f1667a1b7ac9a9d /clang
parente97a53a446df5b4b01ecfa3614f0dbee33fd7d85 (diff)
downloadbcm5719-llvm-82ff1e52dff0ba7ce432433938799e0f3eabd45d.tar.gz
bcm5719-llvm-82ff1e52dff0ba7ce432433938799e0f3eabd45d.zip
Better parser recovery when method is
errornously defined inside an objc class. // rdar://7029784 llvm-svn: 126269
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Parse/Parser.cpp4
-rw-r--r--clang/test/Parser/method-def-in-class.m25
2 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index a50763a0e38..3e1574c33d3 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -296,6 +296,10 @@ bool Parser::SkipUntil(const tok::TokenKind *Toks, unsigned NumToks,
case tok::wide_string_literal:
ConsumeStringToken();
break;
+
+ case tok::at:
+ return false;
+
case tok::semi:
if (StopAtSemi)
return false;
diff --git a/clang/test/Parser/method-def-in-class.m b/clang/test/Parser/method-def-in-class.m
new file mode 100644
index 00000000000..490c0559d10
--- /dev/null
+++ b/clang/test/Parser/method-def-in-class.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7029784
+
+@interface A
+-(id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+}
+@end
+
+@interface B
+-(id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+@end
+
+@interface C
+- (id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+};
+@end
+
+@interface D
+- (id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+@property int P;
+@end
OpenPOWER on IntegriCloud