From 858885578d6bdf82527c2d895368fc0140536b83 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 17 May 2013 17:58:11 +0000 Subject: [PATCH] Objective-C parsing. Error recovery when category implementation declaration is illegally protocol qualified. // rdar://13920026 llvm-svn: 182136 --- clang/lib/Parse/ParseObjc.cpp | 6 ++++++ clang/test/Parser/objc-error-qualified-implementation.m | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 4a572f199328..607b953aad41 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/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/clang/test/Parser/objc-error-qualified-implementation.m b/clang/test/Parser/objc-error-qualified-implementation.m index 444fb5dab44c..8bbd50236027 100644 --- a/clang/test/Parser/objc-error-qualified-implementation.m +++ b/clang/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)

'}}