[cfe-commits] r39506 - in /cfe/cfe/trunk: Parse/ParseStmt.cpp Sema/Sema.h Sema/SemaStmt.cpp include/clang/Parse/Action.h

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:45:05 PDT 2007


Author: clattner
Date: Wed Jul 11 11:45:05 2007
New Revision: 39506

URL: http://llvm.org/viewvc/llvm-project?rev=39506&view=rev
Log:
add action for null stmt, create ast node.

Modified:
    cfe/cfe/trunk/Parse/ParseStmt.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/Sema/SemaStmt.cpp
    cfe/cfe/trunk/include/clang/Parse/Action.h

Modified: cfe/cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseStmt.cpp?rev=39506&r1=39505&r2=39506&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseStmt.cpp Wed Jul 11 11:45:05 2007
@@ -113,10 +113,8 @@
     
   case tok::l_brace:                // C99 6.8.2: compound-statement
     return ParseCompoundStatement();
-  case tok::semi:                   // C99 6.8.3: expression[opt] ';'
-    // TODO: Could return a NullStmt action result if we cared to.
-    ConsumeToken();
-    return 0;
+  case tok::semi:                   // C99 6.8.3p3: expression[opt] ';'
+    return Actions.ParseNullStmt(ConsumeToken());
     
   case tok::kw_if:                  // C99 6.8.4.1: if-statement
     return ParseIfStatement();

Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39506&r1=39505&r2=39506&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:45:05 2007
@@ -133,6 +133,7 @@
   //===--------------------------------------------------------------------===//
   // Statement Parsing Callbacks: SemaStmt.cpp.
 public:
+  virtual StmtResult ParseNullStmt(SourceLocation SemiLoc);
   virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R,
                                        StmtTy **Elts, unsigned NumElts);
   virtual StmtResult ParseExprStmt(ExprTy *Expr) {

Modified: cfe/cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaStmt.cpp?rev=39506&r1=39505&r2=39506&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaStmt.cpp Wed Jul 11 11:45:05 2007
@@ -19,6 +19,10 @@
 using namespace llvm;
 using namespace clang;
 
+Sema::StmtResult Sema::ParseNullStmt(SourceLocation SemiLoc) {
+  return new NullStmt(SemiLoc);
+}
+
 
 Action::StmtResult 
 Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,

Modified: cfe/cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Action.h?rev=39506&r1=39505&r2=39506&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:45:05 2007
@@ -172,6 +172,10 @@
   // Statement Parsing Callbacks.
   //===--------------------------------------------------------------------===//
   
+  virtual StmtResult ParseNullStmt(SourceLocation SemiLoc) {
+    return 0;
+  }
+  
   virtual StmtResult ParseCompoundStmt(SourceLocation L, SourceLocation R,
                                        StmtTy **Elts, unsigned NumElts) {
     return 0;





More information about the cfe-commits mailing list