[cfe-commits] r67928 - in /cfe/trunk: include/clang/AST/DeclGroup.h include/clang/AST/Stmt.h lib/AST/CFG.cpp

Chris Lattner sabre at nondot.org
Fri Mar 27 23:53:40 PDT 2009


Author: lattner
Date: Sat Mar 28 01:53:40 2009
New Revision: 67928

URL: http://llvm.org/viewvc/llvm-project?rev=67928&view=rev
Log:
some random cleanups

Modified:
    cfe/trunk/include/clang/AST/DeclGroup.h
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/lib/AST/CFG.cpp

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclGroup.h (original)
+++ cfe/trunk/include/clang/AST/DeclGroup.h Sat Mar 28 01:53:40 2009
@@ -57,7 +57,6 @@
 };
     
 class DeclGroupRef {
-protected:
   enum Kind { SingleDeclKind=0x0, DeclGroupKind=0x1, Mask=0x1 };  
   Decl* D;
 

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

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sat Mar 28 01:53:40 2009
@@ -225,7 +225,6 @@
 /// the first statement can be an expression or a declaration.
 ///
 class DeclStmt : public Stmt {
-protected:
   DeclGroupRef DG;
   SourceLocation StartLoc, EndLoc;
 public:
@@ -243,6 +242,9 @@
  
   const Decl *getSingleDecl() const { return DG.getSingleDecl(); }
   Decl *getSingleDecl() { return DG.getSingleDecl(); }  
+  
+  const DeclGroupRef getDeclGroup() const { return DG; }
+  DeclGroupRef getDeclGroup() { return DG; }
 
   SourceLocation getStartLoc() const { return StartLoc; }
   SourceLocation getEndLoc() const { return EndLoc; }

Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=67928&r1=67927&r2=67928&view=diff

==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Sat Mar 28 01:53:40 2009
@@ -363,15 +363,12 @@
         return WalkAST_VisitDeclSubExpr(DS->getSingleDecl());
       }
       
-      typedef llvm::SmallVector<Decl*,10> BufTy;
-      BufTy Buf;        
       CFGBlock* B = 0;
 
       // FIXME: Add a reverse iterator for DeclStmt to avoid this
       // extra copy.
-      for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
-           DI != DE; ++DI)
-        Buf.push_back(*DI);
+      typedef llvm::SmallVector<Decl*,10> BufTy;
+      BufTy Buf(DS->decl_begin(), DS->decl_end());
       
       for (BufTy::reverse_iterator I=Buf.rbegin(), E=Buf.rend(); I!=E; ++I) {
         // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
@@ -384,8 +381,7 @@
         Decl* D = *I;
         void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
         
-        DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(),
-                                          GetEndLoc(D));
+        DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(), GetEndLoc(D));
         
         // Append the fake DeclStmt to block.
         Block->appendStmt(DS);





More information about the cfe-commits mailing list