[cfe-commits] r38898 - in /cfe/cfe/trunk/Parse: DeclSpec.cpp ParseDecl.cpp ParseStmt.cpp Parser.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:35 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:35 2007
New Revision: 38898
URL: http://llvm.org/viewvc/llvm-project?rev=38898&view=rev
Log:
Parse things like 'struct X;'
Modified:
cfe/cfe/trunk/Parse/DeclSpec.cpp
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/Parse/ParseStmt.cpp
cfe/cfe/trunk/Parse/Parser.cpp
Modified: cfe/cfe/trunk/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/DeclSpec.cpp?rev=38898&r1=38897&r2=38898&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/DeclSpec.cpp (original)
+++ cfe/cfe/trunk/Parse/DeclSpec.cpp Wed Jul 11 11:25:35 2007
@@ -208,7 +208,7 @@
break;
}
- // FIXME: if the implementation does not implement _Complex or _Imaginary,
+ // TODO: if the implementation does not implement _Complex or _Imaginary,
// disallow their use. Need information about the backend.
if (TypeSpecComplex != TSC_unspecified) {
if (TypeSpecType == TST_unspecified) {
@@ -237,9 +237,9 @@
}
// Okay, now we can infer the real type.
- // FIXME: infer real type.
+ // TODO: infer real type.
- // FIXME: return "auto function" and other bad things based on the real type.
+ // TODO: return "auto function" and other bad things based on the real type.
// 'data definition has no type or storage class'?
}
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=38898&r1=38897&r2=38898&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:25:35 2007
@@ -42,6 +42,16 @@
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
+ // C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
+ // declaration-specifiers init-declarator-list[opt] ';'
+ if (Tok.getKind() == tok::semi) {
+ // TODO: emit error on 'int;' or 'const enum foo;'.
+ // if (!DS.isMissingDeclaratorOk()) Diag(...);
+
+ ConsumeToken();
+ return;
+ }
+
Declarator DeclaratorInfo(DS, (Declarator::TheContext)Context);
ParseDeclarator(DeclaratorInfo);
@@ -169,7 +179,6 @@
// specifiers. First verify that DeclSpec's are consistent.
DS.Finish(StartLoc, Diags, getLang());
return;
- // FIXME: Handle struct/union tags.
// storage-class-specifier
case tok::kw_typedef:
@@ -932,7 +941,8 @@
// it was not a constant expression.
if (!getLang().C99) {
// TODO: check C90 array constant exprness.
- if (isStar || StaticLoc.isValid() || 0/*FIXME: NumElts is constantexpr*/)
+ if (isStar || StaticLoc.isValid() ||
+ 0/*TODO: NumElts is not a C90 constantexpr */)
Diag(StartLoc, diag::ext_c99_array_usage);
}
Modified: cfe/cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseStmt.cpp?rev=38898&r1=38897&r2=38898&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseStmt.cpp Wed Jul 11 11:25:35 2007
@@ -204,6 +204,16 @@
// ParseDeclarationSpecifiers will continue from there.
ParseDeclarationSpecifiers(DS);
+ // C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
+ // declaration-specifiers init-declarator-list[opt] ';'
+ if (Tok.getKind() == tok::semi) {
+ // TODO: emit error on 'int;' or 'const enum foo;'.
+ // if (!DS.isMissingDeclaratorOk()) Diag(...);
+
+ ConsumeToken();
+ return;
+ }
+
// Parse all the declarators.
Declarator DeclaratorInfo(DS, Declarator::BlockContext);
ParseDeclarator(DeclaratorInfo);
Modified: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=38898&r1=38897&r2=38898&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:25:35 2007
@@ -227,9 +227,13 @@
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
- if (Tok.getKind() == tok::semi)
- assert(0 && "Unimp!"); // FIXME: implement 'struct foo;'.
-
+ if (Tok.getKind() == tok::semi) {
+ // TODO: emit error on 'int;' or 'const enum foo;'.
+ // if (!DS.isMissingDeclaratorOk()) Diag(...);
+
+ ConsumeToken();
+ return;
+ }
// Parse the first declarator.
Declarator DeclaratorInfo(DS, Declarator::FileContext);
More information about the cfe-commits
mailing list