[cfe-commits] r38858 - in /cfe/cfe/trunk: Parse/ParseDecl.cpp Parse/ParseExpr.cpp Parse/ParseStmt.cpp include/clang/Parse/Parser.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:15 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:14 2007
New Revision: 38858
URL: http://llvm.org/viewvc/llvm-project?rev=38858&view=rev
Log:
stub out some entry points for the expr parsing code.
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/Parse/ParseExpr.cpp
cfe/cfe/trunk/Parse/ParseStmt.cpp
cfe/cfe/trunk/include/clang/Parse/Parser.h
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=38858&r1=38857&r2=38858&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:25:14 2007
@@ -42,11 +42,9 @@
// Parse declarator '=' initializer.
if (Tok.getKind() == tok::equal) {
ConsumeToken();
- // FIXME: THIS IS WRONG: should ParseInitializer!!
- ParseExpression();
+ ParseInitializer();
}
-
// TODO: install declarator.
// If we don't have a comma, it is either the end of the list (a ';') or an
Modified: cfe/cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExpr.cpp?rev=38858&r1=38857&r2=38858&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:25:14 2007
@@ -16,6 +16,14 @@
using namespace llvm;
using namespace clang;
+// C99 6.7.8
+void Parser::ParseInitializer() {
+ // FIXME: STUB.
+ ParseAssignmentExpression();
+}
+
+
+
Parser::ExprTy Parser::ParseExpression() {
if (Tok.getKind() == tok::numeric_constant) {
ConsumeToken();
@@ -26,11 +34,17 @@
return 0;
}
-///primary-expression:
-/// identifier
-/// constant
-/// string-literal
-/// '(' expression ')'
+// Expr that doesn't include commas.
+void Parser::ParseAssignmentExpression() {
+ ParseExpression();
+}
+
+/// primary-expression:
+/// identifier
+/// constant
+/// string-literal
+/// '(' expression ')'
+
/// ParseParenExpression - C99 c.5.1p5
/// primary-expression:
Modified: cfe/cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseStmt.cpp?rev=38858&r1=38857&r2=38858&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseStmt.cpp Wed Jul 11 11:25:14 2007
@@ -220,7 +220,7 @@
assert(Tok.getKind() == tok::kw_case && "Not a case stmt!");
ConsumeToken(); // eat the 'case'.
- ParseExpression();
+ ParseAssignmentExpression(); // Expr without commas.
if (Tok.getKind() == tok::colon) {
ConsumeToken();
Modified: cfe/cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Parser.h?rev=38858&r1=38857&r2=38858&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Parser.h Wed Jul 11 11:25:14 2007
@@ -157,6 +157,14 @@
void ParseFunctionDefinition(Declarator &D);
//===--------------------------------------------------------------------===//
+ // C99 6.5: Expressions.
+ //ExprTy ParseExpression(); // Above.
+ void ParseAssignmentExpression(); // Expr that doesn't include commas.
+ void ParseParenExpression();
+
+ void ParseInitializer(); // C99 6.7.8
+
+ //===--------------------------------------------------------------------===//
// C99 6.8: Statements and Blocks.
void ParseStatement() { ParseStatementOrDeclaration(true); }
void ParseStatementOrDeclaration(bool OnlyStatement = false);
@@ -174,17 +182,12 @@
//===--------------------------------------------------------------------===//
// C99 6.7: Declarations.
-
+
void ParseDeclaration(unsigned Context);
void ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D);
void ParseDeclarationSpecifiers(DeclSpec &DS);
bool isDeclarationSpecifier() const;
- //===--------------------------------------------------------------------===//
- // C99 6.5: Expressions.
- //ExprTy ParseExpression(); // Above.
- void ParseParenExpression();
-
/// ParseDeclarator - Parse and verify a newly-initialized declarator.
void ParseDeclarator(Declarator &D);
void ParseDeclaratorInternal(Declarator &D);
More information about the cfe-commits
mailing list