diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-28 06:33:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-28 06:33:19 +0000 |
commit | 7e24e82a70a2c681f4291a3397bcd1e1005f251a (patch) | |
tree | db2f005b698e34f2b6c8e21d3636e7c5e39d43ff /lib/AST/CFG.cpp | |
parent | fe95deaf66e4fbd82d44b5f6afa8162fa69cb85c (diff) |
rename some methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CFG.cpp')
-rw-r--r-- | lib/AST/CFG.cpp | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp index 3bfac7fbdc..297758316a 100644 --- a/lib/AST/CFG.cpp +++ b/lib/AST/CFG.cpp @@ -358,41 +358,40 @@ CFGBlock* CFGBuilder::WalkAST(Stmt* Terminator, bool AlwaysAddStmt = false) { case Stmt::DeclStmtClass: { DeclStmt *DS = cast<DeclStmt>(Terminator); - if (DS->hasSolitaryDecl()) { + if (DS->isSingleDecl()) { Block->appendStmt(Terminator); - return WalkAST_VisitDeclSubExpr(DS->getSolitaryDecl()); + return WalkAST_VisitDeclSubExpr(DS->getSingleDecl()); } - else { - 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; + 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); + + 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. + unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8 + ? 8 : llvm::AlignOf<DeclStmt>::Alignment; - 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. - unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8 - ? 8 : llvm::AlignOf<DeclStmt>::Alignment; - - // Allocate the DeclStmt using the BumpPtrAllocator. It will - // get automatically freed with the CFG. - DeclGroupRef DG(*I); - Decl* D = *I; - void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A); - - DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(), - GetEndLoc(D)); - - // Append the fake DeclStmt to block. - Block->appendStmt(DS); - B = WalkAST_VisitDeclSubExpr(D); - } - return B; + // Allocate the DeclStmt using the BumpPtrAllocator. It will + // get automatically freed with the CFG. + DeclGroupRef DG(*I); + Decl* D = *I; + void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A); + + DeclStmt* DS = new (Mem) DeclStmt(DG, D->getLocation(), + GetEndLoc(D)); + + // Append the fake DeclStmt to block. + Block->appendStmt(DS); + B = WalkAST_VisitDeclSubExpr(D); } + return B; } case Stmt::AddrLabelExprClass: { |