diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Parse/Parser.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Parser/method-def-in-class.m | 11 |
3 files changed, 6 insertions, 16 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 56d5c57c056..1f20924c9b7 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -366,8 +366,12 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, allMethods.push_back(methodPrototype); // Consume the ';' here, since ParseObjCMethodPrototype() is re-used for // method definitions. - ExpectAndConsume(tok::semi, diag::err_expected_semi_after_method_proto, - "", tok::semi); + if (ExpectAndConsumeSemi(diag::err_expected_semi_after_method_proto)) { + // We didn't find a semi and we error'ed out. Skip until a ';' or '@'. + SkipUntil(tok::at, /*StopAtSemi=*/true, /*DontConsume=*/true); + if (Tok.is(tok::semi)) + ConsumeToken(); + } continue; } if (Tok.is(tok::l_paren)) { diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 95ce065ff76..c57711dbc6d 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -284,9 +284,6 @@ bool Parser::SkipUntil(const tok::TokenKind *Toks, unsigned NumToks, 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 index 490c0559d10..476ab9ba20e 100644 --- a/clang/test/Parser/method-def-in-class.m +++ b/clang/test/Parser/method-def-in-class.m @@ -7,19 +7,8 @@ } @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 |

