From: Fariborz Jahanian Date: Fri, 17 May 2013 17:58:11 +0000 (+0000) Subject: Objective-C parsing. Error recovery when category implementation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4bb74973cfdf0c82aca2088ccfae5e61727c846;p=clang Objective-C parsing. Error recovery when category implementation declaration is illegally protocol qualified. // rdar://13920026 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182136 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 4a572f1993..607b953aad 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1541,6 +1541,12 @@ Parser::ParseObjCAtImplementationDeclaration(SourceLocation AtLoc) { return DeclGroupPtrTy(); } rparenLoc = ConsumeParen(); + if (Tok.is(tok::less)) { // we have illegal '<' try to recover + Diag(Tok, diag::err_unexpected_protocol_qualifier); + AttributeFactory attr; + DeclSpec DS(attr); + (void)ParseObjCProtocolQualifiers(DS); + } ObjCImpDecl = Actions.ActOnStartCategoryImplementation( AtLoc, nameId, nameLoc, categoryId, categoryLoc); diff --git a/test/Parser/objc-error-qualified-implementation.m b/test/Parser/objc-error-qualified-implementation.m index 444fb5dab4..8bbd502360 100644 --- a/test/Parser/objc-error-qualified-implementation.m +++ b/test/Parser/objc-error-qualified-implementation.m @@ -19,3 +19,11 @@ @implementation K

'}} + +// rdar://13920026 +@implementation I (Cat)

// expected-error {{@implementation declaration can not be protocol qualified}} +- (void) Meth {} +@end + +@implementation I (Cat1)

'}}