[cfe-commits] r39100 - /cfe/cfe/trunk/Parse/Parser.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:27:31 PDT 2007
Author: sabre
Date: Wed Jul 11 11:27:31 2007
New Revision: 39100
URL: http://llvm.org/viewvc/llvm-project?rev=39100&view=rev
Log:
Emit:
test.m:2:14: error: expected ';' after @class
@ class foo int x;
^
instead of silently accepting the malformed input.
Modified:
cfe/cfe/trunk/Parse/Parser.cpp
Modified: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=39100&r1=39099&r2=39100&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:27:31 2007
@@ -482,25 +482,31 @@
///
void Parser::ObjCParseAtClassDeclaration(SourceLocation atLoc) {
ConsumeToken(); // the identifier "class"
- SmallVector<IdentifierInfo *, 8> classNames;
+ SmallVector<IdentifierInfo *, 8> ClassNames;
while (1) {
- if (Tok.getKind() == tok::identifier) {
- classNames.push_back(Tok.getIdentifierInfo());
- } else {
- Diag(diag::err_expected_ident);
- }
- ConsumeToken();
- if (Tok.getKind() == tok::comma)
- ConsumeToken();
- else
- break;
- }
- if (Tok.getKind() == tok::semi) {
- SourceLocation semiLoc = ConsumeToken();
- Actions.ParsedClassDeclaration(CurScope,&classNames[0],classNames.size());
+ if (Tok.getKind() != tok::identifier) {
+ Diag(diag::err_expected_ident);
+ SkipUntil(tok::semi);
+ return;
+ }
+
+ ClassNames.push_back(Tok.getIdentifierInfo());
+ ConsumeToken();
+
+ if (Tok.getKind() != tok::comma)
+ break;
+
+ ConsumeToken();
}
+
+ // Consume the ';'.
+ if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
+ return;
+
+ Actions.ParsedClassDeclaration(CurScope, &ClassNames[0], ClassNames.size());
}
+
void Parser::ObjCParseAtInterfaceDeclaration() {
assert(0 && "Unimp");
}
More information about the cfe-commits
mailing list