]> granicus.if.org Git - clang/commitdiff
Objective-C parsing. Error recovery when category implementation
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 17 May 2013 17:58:11 +0000 (17:58 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 17 May 2013 17:58:11 +0000 (17:58 +0000)
declaration is illegally protocol qualified. // rdar://13920026

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182136 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/Parser/objc-error-qualified-implementation.m

index 4a572f1993280fb18a0a557c586cbbc59b50d7f8..607b953aad4120ea2df564f90b587f105c3fd780 100644 (file)
@@ -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);
index 444fb5dab44c88e7773d05cb9f008917eb03e452..8bbd50236027b56e45875d2ed45997aea3ffbbd8 100644 (file)
 
 @implementation K <P // expected-error {{@implementation declaration can not be protocol qualified}}
 @end // expected-error {{expected '>'}}
+
+// rdar://13920026
+@implementation I (Cat) <P>  // expected-error {{@implementation declaration can not be protocol qualified}}
+- (void) Meth {}
+@end
+
+@implementation I (Cat1) <P // expected-error {{@implementation declaration can not be protocol qualified}}
+@end // expected-error {{expected '>'}}