Do the error recovery for @end only.

I am not sure how much we can improve for
when a randon ObjC keyword is thrown into the
ivar decl. block. // rdar://6854840


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177553 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2013-03-20 18:45:49 +00:00
Родитель b02d1733cf
Коммит 695031cd78
2 изменённых файлов: 7 добавлений и 13 удалений

Просмотреть файл

@ -1303,10 +1303,9 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
visibility = Tok.getObjCKeywordID();
ConsumeToken();
continue;
default:
Diag(Tok, (Tok.getObjCKeywordID() == tok::objc_end) ?
diag::err_objc_unexpected_atend :
diag::err_objc_illegal_visibility_spec);
case tok::objc_end:
Diag(Tok, diag::err_objc_unexpected_atend);
Tok.setLocation(Tok.getLocation().getLocWithOffset(-1));
Tok.setKind(tok::at);
Tok.setLength(1);
@ -1314,6 +1313,10 @@ void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
T, AllIvarDecls, true);
return;
default:
Diag(Tok, diag::err_objc_illegal_visibility_spec);
continue;
}
}

Просмотреть файл

@ -1,12 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar: //6854840
@interface A {@end // expected-error {{'@end' appears where closing brace '}' is expected}}
@interface B {
@public
int ivar;
@protected
id pp;
@property (copy) id PROP; // expected-error {{illegal visibility specification}}
@end