r182136 - Objective-C parsing. Error recovery when category implementation

Fariborz Jahanian fjahanian at apple.com
Fri May 17 10:58:12 PDT 2013


Author: fjahanian
Date: Fri May 17 12:58:11 2013
New Revision: 182136

URL: http://llvm.org/viewvc/llvm-project?rev=182136&view=rev
Log:
Objective-C parsing. Error recovery when category implementation
declaration is illegally protocol qualified. // rdar://13920026

Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/test/Parser/objc-error-qualified-implementation.m

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=182136&r1=182135&r2=182136&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri May 17 12:58:11 2013
@@ -1541,6 +1541,12 @@ Parser::ParseObjCAtImplementationDeclara
       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);

Modified: cfe/trunk/test/Parser/objc-error-qualified-implementation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-error-qualified-implementation.m?rev=182136&r1=182135&r2=182136&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-error-qualified-implementation.m (original)
+++ cfe/trunk/test/Parser/objc-error-qualified-implementation.m Fri May 17 12:58:11 2013
@@ -19,3 +19,11 @@
 
 @implementation K <P // expected-error {{@implementation declaration can not be protocol qualified}}
 @end // expected-error {{expected '>'}}
+
+// rdar://13920026
+ at implementation I (Cat) <P>  // expected-error {{@implementation declaration can not be protocol qualified}}
+- (void) Meth {}
+ at end
+
+ at implementation I (Cat1) <P // expected-error {{@implementation declaration can not be protocol qualified}}
+ at end // expected-error {{expected '>'}}





More information about the cfe-commits mailing list