diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1992,8 +1992,7 @@ if (Scope) return Scope; llvm::BumpPtrAllocator &alloc = cfg->getAllocator(); - return new (alloc.Allocate()) - LocalScope(BumpVectorContext(alloc), ScopePos); + return new (alloc) LocalScope(BumpVectorContext(alloc), ScopePos); } /// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement @@ -5214,8 +5213,7 @@ bool first_block = begin() == end(); // Create the block. - CFGBlock *Mem = getAllocator().Allocate(); - new (Mem) CFGBlock(NumBlockIDs++, BlkBVC, this); + CFGBlock *Mem = new (getAllocator()) CFGBlock(NumBlockIDs++, BlkBVC, this); Blocks.push_back(Mem, BlkBVC); // If this is the first block, set it as the Entry and Exit. diff --git a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp --- a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp +++ b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp @@ -97,8 +97,7 @@ FoldNodeTy* P = APSIntSet.FindNodeOrInsertPos(ID, InsertPos); if (!P) { - P = BPAlloc.Allocate(); - new (P) FoldNodeTy(X); + P = new (BPAlloc) FoldNodeTy(X); APSIntSet.InsertNode(P, InsertPos); } @@ -132,8 +131,7 @@ CompoundValData* D = CompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos); if (!D) { - D = BPAlloc.Allocate(); - new (D) CompoundValData(T, Vals); + D = new (BPAlloc) CompoundValData(T, Vals); CompoundValDataSet.InsertNode(D, InsertPos); } @@ -151,8 +149,7 @@ LazyCompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos); if (!D) { - D = BPAlloc.Allocate(); - new (D) LazyCompoundValData(store, region); + D = new (BPAlloc) LazyCompoundValData(store, region); LazyCompoundValDataSet.InsertNode(D, InsertPos); } @@ -169,8 +166,7 @@ PointerToMemberDataSet.FindNodeOrInsertPos(ID, InsertPos); if (!D) { - D = BPAlloc.Allocate(); - new (D) PointerToMemberData(ND, L); + D = new (BPAlloc) PointerToMemberData(ND, L); PointerToMemberDataSet.InsertNode(D, InsertPos); } @@ -358,8 +354,7 @@ FoldNodeTy* P = Map.FindNodeOrInsertPos(ID, InsertPos); if (!P) { - P = BPAlloc.Allocate(); - new (P) FoldNodeTy(std::make_pair(V, Data)); + P = new (BPAlloc) FoldNodeTy(std::make_pair(V, Data)); Map.InsertNode(P, InsertPos); } @@ -383,8 +378,7 @@ FoldNodeTy* P = Map.FindNodeOrInsertPos(ID, InsertPos); if (!P) { - P = BPAlloc.Allocate(); - new (P) FoldNodeTy(std::make_pair(V1, V2)); + P = new (BPAlloc) FoldNodeTy(std::make_pair(V1, V2)); Map.InsertNode(P, InsertPos); } diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp --- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -233,8 +233,7 @@ ExplodedNode *Old = Storage.get(); BumpVectorContext &Ctx = G.getNodeAllocator(); - V = G.getAllocator().Allocate(); - new (V) ExplodedNodeVector(Ctx, 4); + V = new (G.getAllocator()) ExplodedNodeVector(Ctx, 4); V->push_back(Old, Ctx); Storage = V; diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -73,8 +73,7 @@ auto *R = cast_or_null(Regions.FindNodeOrInsertPos(ID, InsertPos)); if (!R) { - R = A.Allocate(); - new (R) RegionTy(arg1, superRegion); + R = new (A) RegionTy(arg1, superRegion); Regions.InsertNode(R, InsertPos); } @@ -90,8 +89,7 @@ auto *R = cast_or_null(Regions.FindNodeOrInsertPos(ID, InsertPos)); if (!R) { - R = A.Allocate(); - new (R) RegionTy(arg1, arg2, superRegion); + R = new (A) RegionTy(arg1, arg2, superRegion); Regions.InsertNode(R, InsertPos); } @@ -109,8 +107,7 @@ auto *R = cast_or_null(Regions.FindNodeOrInsertPos(ID, InsertPos)); if (!R) { - R = A.Allocate(); - new (R) RegionTy(arg1, arg2, arg3, superRegion); + R = new (A) RegionTy(arg1, arg2, arg3, superRegion); Regions.InsertNode(R, InsertPos); } @@ -834,8 +831,7 @@ template const REG *MemRegionManager::LazyAllocate(REG*& region) { if (!region) { - region = A.Allocate(); - new (region) REG(*this); + region = new (A) REG(*this); } return region; @@ -844,8 +840,7 @@ template const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) { if (!region) { - region = A.Allocate(); - new (region) REG(this, a); + region = new (A) REG(this, a); } return region; @@ -859,8 +854,7 @@ if (R) return R; - R = A.Allocate(); - new (R) StackLocalsSpaceRegion(*this, STC); + R = new (A) StackLocalsSpaceRegion(*this, STC); return R; } @@ -872,8 +866,7 @@ if (R) return R; - R = A.Allocate(); - new (R) StackArgumentsSpaceRegion(*this, STC); + R = new (A) StackArgumentsSpaceRegion(*this, STC); return R; } @@ -894,8 +887,7 @@ if (R) return R; - R = A.Allocate(); - new (R) StaticGlobalSpaceRegion(*this, CR); + R = new (A) StaticGlobalSpaceRegion(*this, CR); return R; } @@ -1141,8 +1133,7 @@ auto *R = cast_or_null(data); if (!R) { - R = A.Allocate(); - new (R) ElementRegion(T, Idx, superRegion); + R = new (A) ElementRegion(T, Idx, superRegion); Regions.InsertNode(R, InsertPos); } @@ -1660,10 +1651,8 @@ using VarVec = BumpVector; - auto *BV = A.Allocate(); - new (BV) VarVec(BC, NumBlockVars); - auto *BVOriginal = A.Allocate(); - new (BVOriginal) VarVec(BC, NumBlockVars); + auto *BV = new (A) VarVec(BC, NumBlockVars); + auto *BVOriginal = new (A) VarVec(BC, NumBlockVars); for (const auto *VD : ReferencedBlockVars) { const VarRegion *VR = nullptr; diff --git a/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp b/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp --- a/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/SymbolManager.cpp @@ -170,8 +170,7 @@ void *InsertPos; SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos); if (!SD) { - SD = BPAlloc.Allocate(); - new (SD) SymbolRegionValue(SymbolCounter, R); + SD = new (BPAlloc) SymbolRegionValue(SymbolCounter, R); DataSet.InsertNode(SD, InsertPos); ++SymbolCounter; } @@ -189,8 +188,7 @@ void *InsertPos; SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos); if (!SD) { - SD = BPAlloc.Allocate(); - new (SD) SymbolConjured(SymbolCounter, E, LCtx, T, Count, SymbolTag); + SD = new (BPAlloc) SymbolConjured(SymbolCounter, E, LCtx, T, Count, SymbolTag); DataSet.InsertNode(SD, InsertPos); ++SymbolCounter; } @@ -206,8 +204,7 @@ void *InsertPos; SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos); if (!SD) { - SD = BPAlloc.Allocate(); - new (SD) SymbolDerived(SymbolCounter, parentSymbol, R); + SD = new (BPAlloc) SymbolDerived(SymbolCounter, parentSymbol, R); DataSet.InsertNode(SD, InsertPos); ++SymbolCounter; } @@ -222,8 +219,7 @@ void *InsertPos; SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos); if (!SD) { - SD = BPAlloc.Allocate(); - new (SD) SymbolExtent(SymbolCounter, R); + SD = new (BPAlloc) SymbolExtent(SymbolCounter, R); DataSet.InsertNode(SD, InsertPos); ++SymbolCounter; } @@ -240,8 +236,7 @@ void *InsertPos; SymExpr *SD = DataSet.FindNodeOrInsertPos(profile, InsertPos); if (!SD) { - SD = BPAlloc.Allocate(); - new (SD) SymbolMetadata(SymbolCounter, R, S, T, LCtx, Count, SymbolTag); + SD = new (BPAlloc) SymbolMetadata(SymbolCounter, R, S, T, LCtx, Count, SymbolTag); DataSet.InsertNode(SD, InsertPos); ++SymbolCounter; } @@ -257,8 +252,7 @@ void *InsertPos; SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos); if (!data) { - data = BPAlloc.Allocate(); - new (data) SymbolCast(Op, From, To); + data = new (BPAlloc) SymbolCast(Op, From, To); DataSet.InsertNode(data, InsertPos); } @@ -275,8 +269,7 @@ SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos); if (!data) { - data = BPAlloc.Allocate(); - new (data) SymIntExpr(lhs, op, v, t); + data = new (BPAlloc) SymIntExpr(lhs, op, v, t); DataSet.InsertNode(data, InsertPos); } @@ -293,8 +286,7 @@ SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos); if (!data) { - data = BPAlloc.Allocate(); - new (data) IntSymExpr(lhs, op, rhs, t); + data = new (BPAlloc) IntSymExpr(lhs, op, rhs, t); DataSet.InsertNode(data, InsertPos); } @@ -311,8 +303,7 @@ SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos); if (!data) { - data = BPAlloc.Allocate(); - new (data) SymSymExpr(lhs, op, rhs, t); + data = new (BPAlloc) SymSymExpr(lhs, op, rhs, t); DataSet.InsertNode(data, InsertPos); } @@ -327,8 +318,7 @@ void *InsertPos; SymExpr *data = DataSet.FindNodeOrInsertPos(ID, InsertPos); if (!data) { - data = BPAlloc.Allocate(); - new (data) UnarySymExpr(Operand, Opc, T); + data = new (BPAlloc) UnarySymExpr(Operand, Opc, T); DataSet.InsertNode(data, InsertPos); }