[cfe-commits] r39156 - in /cfe/cfe/trunk: AST/Sema.cpp AST/SemaStmt.cpp Sema/Sema.cpp Sema/SemaStmt.cpp clang.xcodeproj/project.pbxproj

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:40:06 PDT 2007


Author: sabre
Date: Wed Jul 11 11:40:05 2007
New Revision: 39156

URL: http://llvm.org/viewvc/llvm-project?rev=39156&view=rev
Log:
move semantic analysis of statements to it's own file.

Added:
    cfe/cfe/trunk/AST/SemaStmt.cpp   (with props)
    cfe/cfe/trunk/Sema/SemaStmt.cpp   (with props)
Modified:
    cfe/cfe/trunk/AST/Sema.cpp
    cfe/cfe/trunk/Sema/Sema.cpp
    cfe/cfe/trunk/clang.xcodeproj/project.pbxproj

Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=39156&r1=39155&r2=39156&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:40:05 2007
@@ -84,97 +84,6 @@
 }
 
 //===--------------------------------------------------------------------===//
-// Statement Parsing Callbacks.
-//===--------------------------------------------------------------------===//
-
-Action::StmtResult 
-Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,
-                        StmtTy **Elts, unsigned NumElts) {
-  if (NumElts > 1)
-    return new CompoundStmt((Stmt**)Elts, NumElts);
-  else if (NumElts == 1)
-    return Elts[0];        // {stmt} -> stmt
-  else
-    return 0;              // {}  -> ;
-}
-
-Action::StmtResult
-Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
-                    SourceLocation DotDotDotLoc, ExprTy *RHSVal,
-                    SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new CaseStmt((Expr*)LHSVal, (Expr*)RHSVal, (Stmt*)SubStmt);
-}
-
-Action::StmtResult
-Sema::ParseDefaultStmt(SourceLocation DefaultLoc,
-                       SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new DefaultStmt((Stmt*)SubStmt);
-}
-
-Action::StmtResult
-Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
-                     SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new LabelStmt(II, (Stmt*)SubStmt);
-}
-
-Action::StmtResult 
-Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
-                  StmtTy *ThenVal, SourceLocation ElseLoc,
-                  StmtTy *ElseVal) {
-  return new IfStmt((Expr*)CondVal, (Stmt*)ThenVal, (Stmt*)ElseVal);
-}
-Action::StmtResult
-Sema::ParseSwitchStmt(SourceLocation SwitchLoc, ExprTy *Cond, StmtTy *Body) {
-  return new SwitchStmt((Expr*)Cond, (Stmt*)Body);
-}
-
-Action::StmtResult
-Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body){
-  return new WhileStmt((Expr*)Cond, (Stmt*)Body);
-}
-
-Action::StmtResult
-Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body,
-                  SourceLocation WhileLoc, ExprTy *Cond) {
-  return new DoStmt((Stmt*)Body, (Expr*)Cond);
-}
-
-Action::StmtResult 
-Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, 
-                   StmtTy *First, ExprTy *Second, ExprTy *Third,
-                   SourceLocation RParenLoc, StmtTy *Body) {
-  return new ForStmt((Stmt*)First, (Expr*)Second, (Expr*)Third, (Stmt*)Body);
-}
-
-
-Action::StmtResult 
-Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
-                    IdentifierInfo *LabelII) {
-  return new GotoStmt(LabelII);
-}
-Action::StmtResult 
-Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc,
-                            ExprTy *DestExp) {
-  return new IndirectGotoStmt((Expr*)DestExp);
-}
-
-Action::StmtResult 
-Sema::ParseContinueStmt(SourceLocation ContinueLoc) {
-  return new ContinueStmt();
-}
-
-Action::StmtResult 
-Sema::ParseBreakStmt(SourceLocation GotoLoc) {
-  return new BreakStmt();
-}
-
-
-Action::StmtResult
-Sema::ParseReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp) {
-  return new ReturnStmt((Expr*)RetValExp);
-}
-
-//===--------------------------------------------------------------------===//
 // Expression Parsing Callbacks.
 //===--------------------------------------------------------------------===//
 

Added: cfe/cfe/trunk/AST/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaStmt.cpp?rev=39156&view=auto

==============================================================================
--- cfe/cfe/trunk/AST/SemaStmt.cpp (added)
+++ cfe/cfe/trunk/AST/SemaStmt.cpp Wed Jul 11 11:40:05 2007
@@ -0,0 +1,106 @@
+//===--- SemaStmt.cpp - Semantic Analysis for Statements ------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements semantic analysis for statements.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Sema.h"
+#include "clang/AST/Stmt.h"
+using namespace llvm;
+using namespace clang;
+
+
+Action::StmtResult 
+Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,
+                        StmtTy **Elts, unsigned NumElts) {
+  if (NumElts > 1)
+    return new CompoundStmt((Stmt**)Elts, NumElts);
+  else if (NumElts == 1)
+    return Elts[0];        // {stmt} -> stmt
+  else
+    return 0;              // {}  -> ;
+}
+
+Action::StmtResult
+Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
+                    SourceLocation DotDotDotLoc, ExprTy *RHSVal,
+                    SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new CaseStmt((Expr*)LHSVal, (Expr*)RHSVal, (Stmt*)SubStmt);
+}
+
+Action::StmtResult
+Sema::ParseDefaultStmt(SourceLocation DefaultLoc,
+                       SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new DefaultStmt((Stmt*)SubStmt);
+}
+
+Action::StmtResult
+Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
+                     SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new LabelStmt(II, (Stmt*)SubStmt);
+}
+
+Action::StmtResult 
+Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
+                  StmtTy *ThenVal, SourceLocation ElseLoc,
+                  StmtTy *ElseVal) {
+  return new IfStmt((Expr*)CondVal, (Stmt*)ThenVal, (Stmt*)ElseVal);
+}
+Action::StmtResult
+Sema::ParseSwitchStmt(SourceLocation SwitchLoc, ExprTy *Cond, StmtTy *Body) {
+  return new SwitchStmt((Expr*)Cond, (Stmt*)Body);
+}
+
+Action::StmtResult
+Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body){
+  return new WhileStmt((Expr*)Cond, (Stmt*)Body);
+}
+
+Action::StmtResult
+Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body,
+                  SourceLocation WhileLoc, ExprTy *Cond) {
+  return new DoStmt((Stmt*)Body, (Expr*)Cond);
+}
+
+Action::StmtResult 
+Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, 
+                   StmtTy *First, ExprTy *Second, ExprTy *Third,
+                   SourceLocation RParenLoc, StmtTy *Body) {
+  return new ForStmt((Stmt*)First, (Expr*)Second, (Expr*)Third, (Stmt*)Body);
+}
+
+
+Action::StmtResult 
+Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
+                    IdentifierInfo *LabelII) {
+  return new GotoStmt(LabelII);
+}
+Action::StmtResult 
+Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc,
+                            ExprTy *DestExp) {
+  return new IndirectGotoStmt((Expr*)DestExp);
+}
+
+Action::StmtResult 
+Sema::ParseContinueStmt(SourceLocation ContinueLoc) {
+  return new ContinueStmt();
+}
+
+Action::StmtResult 
+Sema::ParseBreakStmt(SourceLocation GotoLoc) {
+  return new BreakStmt();
+}
+
+
+Action::StmtResult
+Sema::ParseReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp) {
+  return new ReturnStmt((Expr*)RetValExp);
+}
+

Propchange: cfe/cfe/trunk/AST/SemaStmt.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/AST/SemaStmt.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:40:05 2007
@@ -84,97 +84,6 @@
 }
 
 //===--------------------------------------------------------------------===//
-// Statement Parsing Callbacks.
-//===--------------------------------------------------------------------===//
-
-Action::StmtResult 
-Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,
-                        StmtTy **Elts, unsigned NumElts) {
-  if (NumElts > 1)
-    return new CompoundStmt((Stmt**)Elts, NumElts);
-  else if (NumElts == 1)
-    return Elts[0];        // {stmt} -> stmt
-  else
-    return 0;              // {}  -> ;
-}
-
-Action::StmtResult
-Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
-                    SourceLocation DotDotDotLoc, ExprTy *RHSVal,
-                    SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new CaseStmt((Expr*)LHSVal, (Expr*)RHSVal, (Stmt*)SubStmt);
-}
-
-Action::StmtResult
-Sema::ParseDefaultStmt(SourceLocation DefaultLoc,
-                       SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new DefaultStmt((Stmt*)SubStmt);
-}
-
-Action::StmtResult
-Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
-                     SourceLocation ColonLoc, StmtTy *SubStmt) {
-  return new LabelStmt(II, (Stmt*)SubStmt);
-}
-
-Action::StmtResult 
-Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
-                  StmtTy *ThenVal, SourceLocation ElseLoc,
-                  StmtTy *ElseVal) {
-  return new IfStmt((Expr*)CondVal, (Stmt*)ThenVal, (Stmt*)ElseVal);
-}
-Action::StmtResult
-Sema::ParseSwitchStmt(SourceLocation SwitchLoc, ExprTy *Cond, StmtTy *Body) {
-  return new SwitchStmt((Expr*)Cond, (Stmt*)Body);
-}
-
-Action::StmtResult
-Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body){
-  return new WhileStmt((Expr*)Cond, (Stmt*)Body);
-}
-
-Action::StmtResult
-Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body,
-                  SourceLocation WhileLoc, ExprTy *Cond) {
-  return new DoStmt((Stmt*)Body, (Expr*)Cond);
-}
-
-Action::StmtResult 
-Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, 
-                   StmtTy *First, ExprTy *Second, ExprTy *Third,
-                   SourceLocation RParenLoc, StmtTy *Body) {
-  return new ForStmt((Stmt*)First, (Expr*)Second, (Expr*)Third, (Stmt*)Body);
-}
-
-
-Action::StmtResult 
-Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
-                    IdentifierInfo *LabelII) {
-  return new GotoStmt(LabelII);
-}
-Action::StmtResult 
-Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc,
-                            ExprTy *DestExp) {
-  return new IndirectGotoStmt((Expr*)DestExp);
-}
-
-Action::StmtResult 
-Sema::ParseContinueStmt(SourceLocation ContinueLoc) {
-  return new ContinueStmt();
-}
-
-Action::StmtResult 
-Sema::ParseBreakStmt(SourceLocation GotoLoc) {
-  return new BreakStmt();
-}
-
-
-Action::StmtResult
-Sema::ParseReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp) {
-  return new ReturnStmt((Expr*)RetValExp);
-}
-
-//===--------------------------------------------------------------------===//
 // Expression Parsing Callbacks.
 //===--------------------------------------------------------------------===//
 

Added: cfe/cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaStmt.cpp?rev=39156&view=auto

==============================================================================
--- cfe/cfe/trunk/Sema/SemaStmt.cpp (added)
+++ cfe/cfe/trunk/Sema/SemaStmt.cpp Wed Jul 11 11:40:05 2007
@@ -0,0 +1,106 @@
+//===--- SemaStmt.cpp - Semantic Analysis for Statements ------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements semantic analysis for statements.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Sema.h"
+#include "clang/AST/Stmt.h"
+using namespace llvm;
+using namespace clang;
+
+
+Action::StmtResult 
+Sema::ParseCompoundStmt(SourceLocation L, SourceLocation R,
+                        StmtTy **Elts, unsigned NumElts) {
+  if (NumElts > 1)
+    return new CompoundStmt((Stmt**)Elts, NumElts);
+  else if (NumElts == 1)
+    return Elts[0];        // {stmt} -> stmt
+  else
+    return 0;              // {}  -> ;
+}
+
+Action::StmtResult
+Sema::ParseCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
+                    SourceLocation DotDotDotLoc, ExprTy *RHSVal,
+                    SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new CaseStmt((Expr*)LHSVal, (Expr*)RHSVal, (Stmt*)SubStmt);
+}
+
+Action::StmtResult
+Sema::ParseDefaultStmt(SourceLocation DefaultLoc,
+                       SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new DefaultStmt((Stmt*)SubStmt);
+}
+
+Action::StmtResult
+Sema::ParseLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
+                     SourceLocation ColonLoc, StmtTy *SubStmt) {
+  return new LabelStmt(II, (Stmt*)SubStmt);
+}
+
+Action::StmtResult 
+Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
+                  StmtTy *ThenVal, SourceLocation ElseLoc,
+                  StmtTy *ElseVal) {
+  return new IfStmt((Expr*)CondVal, (Stmt*)ThenVal, (Stmt*)ElseVal);
+}
+Action::StmtResult
+Sema::ParseSwitchStmt(SourceLocation SwitchLoc, ExprTy *Cond, StmtTy *Body) {
+  return new SwitchStmt((Expr*)Cond, (Stmt*)Body);
+}
+
+Action::StmtResult
+Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body){
+  return new WhileStmt((Expr*)Cond, (Stmt*)Body);
+}
+
+Action::StmtResult
+Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body,
+                  SourceLocation WhileLoc, ExprTy *Cond) {
+  return new DoStmt((Stmt*)Body, (Expr*)Cond);
+}
+
+Action::StmtResult 
+Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, 
+                   StmtTy *First, ExprTy *Second, ExprTy *Third,
+                   SourceLocation RParenLoc, StmtTy *Body) {
+  return new ForStmt((Stmt*)First, (Expr*)Second, (Expr*)Third, (Stmt*)Body);
+}
+
+
+Action::StmtResult 
+Sema::ParseGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
+                    IdentifierInfo *LabelII) {
+  return new GotoStmt(LabelII);
+}
+Action::StmtResult 
+Sema::ParseIndirectGotoStmt(SourceLocation GotoLoc,SourceLocation StarLoc,
+                            ExprTy *DestExp) {
+  return new IndirectGotoStmt((Expr*)DestExp);
+}
+
+Action::StmtResult 
+Sema::ParseContinueStmt(SourceLocation ContinueLoc) {
+  return new ContinueStmt();
+}
+
+Action::StmtResult 
+Sema::ParseBreakStmt(SourceLocation GotoLoc) {
+  return new BreakStmt();
+}
+
+
+Action::StmtResult
+Sema::ParseReturnStmt(SourceLocation ReturnLoc, ExprTy *RetValExp) {
+  return new ReturnStmt((Expr*)RetValExp);
+}
+

Propchange: cfe/cfe/trunk/Sema/SemaStmt.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Sema/SemaStmt.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=39156&r1=39155&r2=39156&view=diff

==============================================================================
--- cfe/cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/cfe/trunk/clang.xcodeproj/project.pbxproj Wed Jul 11 11:40:05 2007
@@ -129,7 +129,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
+		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
 		DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };
 		DE06BECA0A854E4B0050E87E /* Scope.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Scope.h; path = clang/Parse/Scope.h; sourceTree = "<group>"; };
 		DE06D42F0A8BB52D0050E87E /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Parser.cpp; path = Parse/Parser.cpp; sourceTree = "<group>"; };





More information about the cfe-commits mailing list