[cfe-commits] r38920 - /cfe/cfe/trunk/Parse/ParseDecl.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:46 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:46 2007
New Revision: 38920
URL: http://llvm.org/viewvc/llvm-project?rev=38920&view=rev
Log:
"enum x" really is a type specifier
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=38920&r1=38919&r2=38920&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:25:46 2007
@@ -480,37 +480,36 @@
if (Tok.getKind() == tok::identifier)
ConsumeToken();
- if (Tok.getKind() != tok::l_brace)
- return;
-
- SourceLocation LBraceLoc = Tok.getLocation();
- ConsumeBrace();
-
- if (Tok.getKind() == tok::r_brace)
- Diag(Tok, diag::ext_empty_struct_union_enum, "enum");
-
- // Parse the enumerator-list.
- while (Tok.getKind() == tok::identifier) {
- ConsumeToken();
+ if (Tok.getKind() == tok::l_brace) {
+ SourceLocation LBraceLoc = Tok.getLocation();
+ ConsumeBrace();
- if (Tok.getKind() == tok::equal) {
+ if (Tok.getKind() == tok::r_brace)
+ Diag(Tok, diag::ext_empty_struct_union_enum, "enum");
+
+ // Parse the enumerator-list.
+ while (Tok.getKind() == tok::identifier) {
ConsumeToken();
- ExprResult Res = ParseConstantExpression();
- if (Res.isInvalid) SkipUntil(tok::comma, true, false);
+
+ if (Tok.getKind() == tok::equal) {
+ ConsumeToken();
+ ExprResult Res = ParseConstantExpression();
+ if (Res.isInvalid) SkipUntil(tok::comma, true, false);
+ }
+
+ if (Tok.getKind() != tok::comma)
+ break;
+ SourceLocation CommaLoc = Tok.getLocation();
+ ConsumeToken();
+
+ if (Tok.getKind() != tok::identifier && !getLang().C99)
+ Diag(CommaLoc, diag::ext_c99_enumerator_list_comma);
}
- if (Tok.getKind() != tok::comma)
- break;
- SourceLocation CommaLoc = Tok.getLocation();
- ConsumeToken();
-
- if (Tok.getKind() != tok::identifier && !getLang().C99)
- Diag(CommaLoc, diag::ext_c99_enumerator_list_comma);
+ // Eat the }.
+ MatchRHSPunctuation(tok::r_brace, LBraceLoc, "{",
+ diag::err_expected_rbrace);
}
-
- // Eat the }.
- MatchRHSPunctuation(tok::r_brace, LBraceLoc, "{",
- diag::err_expected_rbrace);
// TODO: semantic analysis on the declspec for enums.
More information about the cfe-commits
mailing list