Objective-C parsing. Error recovery when category implementation

declaration is illegally protocol qualified. // rdar://13920026

llvm-svn: 182136
This commit is contained in:
Fariborz Jahanian 2013-05-17 17:58:11 +00:00
parent cb63bafefc
commit 858885578d
2 changed files with 14 additions and 0 deletions

View 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);

View File

@ -19,3 +19,11 @@
@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 '>'}}