[cfe-commits] r46547 - in /cfe/trunk: AST/Stmt.cpp CodeGen/CGExprAgg.cpp include/clang/AST/Stmt.h

Chris Lattner sabre at nondot.org
Tue Jan 29 21:01:46 PST 2008


Author: lattner
Date: Tue Jan 29 23:01:46 2008
New Revision: 46547

URL: http://llvm.org/viewvc/llvm-project?rev=46547&view=rev
Log:
move some constructors out of line and fix indentation in ObjCAtThrowStmt::getSourceRange.

Modified:
    cfe/trunk/AST/Stmt.cpp
    cfe/trunk/CodeGen/CGExprAgg.cpp
    cfe/trunk/include/clang/AST/Stmt.h

Modified: cfe/trunk/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Stmt.cpp?rev=46547&r1=46546&r2=46547&view=diff

==============================================================================
--- cfe/trunk/AST/Stmt.cpp (original)
+++ cfe/trunk/AST/Stmt.cpp Tue Jan 29 23:01:46 2008
@@ -111,20 +111,17 @@
   }
 }
 
-AsmStmt::AsmStmt(SourceLocation asmloc, 
-                 bool isvolatile,
-                 unsigned numoutputs,
-                 unsigned numinputs,
-                 std::string *names,
-                 StringLiteral **constraints,
-                 Expr **exprs,
-                 StringLiteral *asmstr,
-                 unsigned numclobbers,
-                 StringLiteral **clobbers,                 
-                 SourceLocation rparenloc)
+//===----------------------------------------------------------------------===//
+// Constructors
+//===----------------------------------------------------------------------===//
+
+AsmStmt::AsmStmt(SourceLocation asmloc,  bool isvolatile,
+                 unsigned numoutputs, unsigned numinputs,
+                 std::string *names, StringLiteral **constraints,
+                 Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
+                 StringLiteral **clobbers, SourceLocation rparenloc)
   : Stmt(AsmStmtClass), AsmLoc(asmloc), RParenLoc(rparenloc), AsmStr(asmstr)
-  , IsVolatile(isvolatile), NumOutputs(numoutputs), NumInputs(numinputs)
-{
+  , IsVolatile(isvolatile), NumOutputs(numoutputs), NumInputs(numinputs) {
   for (unsigned i = 0, e = numinputs + numoutputs; i != e; i++) {
     Names.push_back(names[i]);
     Exprs.push_back(exprs[i]);
@@ -135,6 +132,39 @@
     Clobbers.push_back(clobbers[i]);
 }
 
+ObjCForCollectionStmt::ObjCForCollectionStmt(Stmt *Elem, Expr *Collect,
+                                             Stmt *Body,  SourceLocation FCL,
+                                             SourceLocation RPL) 
+: Stmt(ObjCForCollectionStmtClass) {
+  SubExprs[ELEM] = Elem;
+  SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
+  SubExprs[BODY] = Body;
+  ForLoc = FCL;
+  RParenLoc = RPL;
+}
+
+
+ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc, 
+                                 SourceLocation rparenloc, 
+                                 Stmt *catchVarStmtDecl, Stmt *atCatchStmt, 
+                                 Stmt *atCatchList)
+: Stmt(ObjCAtCatchStmtClass) {
+  SubExprs[SELECTOR] = catchVarStmtDecl;
+  SubExprs[BODY] = atCatchStmt;
+  if (!atCatchList)
+    NextAtCatchStmt = NULL;
+  else {
+    ObjCAtCatchStmt *AtCatchList = 
+    static_cast<ObjCAtCatchStmt*>(atCatchList);
+    while (AtCatchList->NextAtCatchStmt)
+      AtCatchList = AtCatchList->NextAtCatchStmt;
+    AtCatchList->NextAtCatchStmt = this;
+  }
+  AtCatchLoc = atCatchLoc;
+  RParenLoc = rparenloc;
+}
+
+
 //===----------------------------------------------------------------------===//
 //  Child Iterators for iterating over subexpressions/substatements
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprAgg.cpp?rev=46547&r1=46546&r2=46547&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/CodeGen/CGExprAgg.cpp Tue Jan 29 23:01:46 2008
@@ -225,7 +225,7 @@
   // Copy initializer elements.
   bool AllConstElements = true;
   unsigned i = 0;
-  for (i = 0; i < NumInitElements; ++i) {
+  for (i = 0; i != NumInitElements; ++i) {
     if (llvm::Constant *C = 
         dyn_cast<llvm::Constant>(CGF.EmitScalarExpr(E->getInit(i))))
       ArrayElts.push_back(C);

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=46547&r1=46546&r2=46547&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Tue Jan 29 23:01:46 2008
@@ -588,15 +588,8 @@
   SourceLocation RParenLoc;
 public:
   ObjCForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body, 
-                        SourceLocation FCL, SourceLocation RPL) 
-  : Stmt(ObjCForCollectionStmtClass) {
-    SubExprs[ELEM] = Elem;
-    SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
-    SubExprs[BODY] = Body;
-    ForLoc = FCL;
-    RParenLoc = RPL;
-  }
-    
+                        SourceLocation FCL, SourceLocation RPL);
+  
   Stmt *getElement() { return SubExprs[ELEM]; }
   Expr *getCollection() { 
     return reinterpret_cast<Expr*>(SubExprs[COLLECTION]); 
@@ -773,17 +766,10 @@
 
   llvm::SmallVector<StringLiteral*, 4> Clobbers;
 public:
-  AsmStmt(SourceLocation asmloc, 
-          bool isvolatile,
-          unsigned numoutputs,
-          unsigned numinputs,
-          std::string *names,
-          StringLiteral **constraints,
-          Expr **exprs,
-          StringLiteral *asmstr,
-          unsigned numclobbers,
-          StringLiteral **clobbers,
-          SourceLocation rparenloc);
+  AsmStmt(SourceLocation asmloc,  bool isvolatile, unsigned numoutputs,
+          unsigned numinputs, std::string *names, StringLiteral **constraints,
+          Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
+          StringLiteral **clobbers, SourceLocation rparenloc);
 
   bool isVolatile() const { return IsVolatile; }
   
@@ -843,22 +829,7 @@
 
 public:
   ObjCAtCatchStmt(SourceLocation atCatchLoc, SourceLocation rparenloc,
-                  Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList)
-  : Stmt(ObjCAtCatchStmtClass) {
-      SubExprs[SELECTOR] = catchVarStmtDecl;
-      SubExprs[BODY] = atCatchStmt;
-      if (!atCatchList)
-        NextAtCatchStmt = NULL;
-      else {
-        ObjCAtCatchStmt *AtCatchList = 
-          static_cast<ObjCAtCatchStmt*>(atCatchList);
-        while (AtCatchList->NextAtCatchStmt)
-          AtCatchList = AtCatchList->NextAtCatchStmt;
-        AtCatchList->NextAtCatchStmt = this;
-      }
-      AtCatchLoc = atCatchLoc;
-      RParenLoc = rparenloc;
-    }
+                  Stmt *catchVarStmtDecl, Stmt *atCatchStmt, Stmt *atCatchList);
   
   const Stmt *getCatchBody() const { return SubExprs[BODY]; }
   Stmt *getCatchBody() { return SubExprs[BODY]; }
@@ -1020,8 +991,8 @@
   virtual SourceRange getSourceRange() const {
     if (Throw)
       return SourceRange(AtThrowLoc, Throw->getLocEnd()); 
-	else 
-	  return SourceRange(AtThrowLoc);
+    else 
+      return SourceRange(AtThrowLoc);
   }
   
   static bool classof(const Stmt *T) {





More information about the cfe-commits mailing list