[llvm] r206249 - Use unique_ptr to manage ownership of GCFunctionInfos in GCStrategy
David Blaikie
dblaikie at gmail.com
Mon Apr 14 23:07:26 PDT 2014
Author: dblaikie
Date: Tue Apr 15 01:07:26 2014
New Revision: 206249
URL: http://llvm.org/viewvc/llvm-project?rev=206249&view=rev
Log:
Use unique_ptr to manage ownership of GCFunctionInfos in GCStrategy
Modified:
llvm/trunk/include/llvm/CodeGen/GCStrategy.h
llvm/trunk/lib/CodeGen/GCStrategy.cpp
Modified: llvm/trunk/include/llvm/CodeGen/GCStrategy.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GCStrategy.h?rev=206249&r1=206248&r2=206249&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GCStrategy.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GCStrategy.h Tue Apr 15 01:07:26 2014
@@ -54,7 +54,7 @@ namespace llvm {
/// be abstractly described.
class GCStrategy {
public:
- typedef std::vector<GCFunctionInfo*> list_type;
+ typedef std::vector<std::unique_ptr<GCFunctionInfo>> list_type;
typedef list_type::iterator iterator;
private:
@@ -77,7 +77,7 @@ namespace llvm {
public:
GCStrategy();
- virtual ~GCStrategy();
+ virtual ~GCStrategy() {}
/// getName - The name of the GC strategy, for debugging.
Modified: llvm/trunk/lib/CodeGen/GCStrategy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCStrategy.cpp?rev=206249&r1=206248&r2=206249&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GCStrategy.cpp (original)
+++ llvm/trunk/lib/CodeGen/GCStrategy.cpp Tue Apr 15 01:07:26 2014
@@ -101,13 +101,6 @@ GCStrategy::GCStrategy() :
UsesMetadata(false)
{}
-GCStrategy::~GCStrategy() {
- for (iterator I = begin(), E = end(); I != E; ++I)
- delete *I;
-
- Functions.clear();
-}
-
bool GCStrategy::initializeCustomLowering(Module &M) { return false; }
bool GCStrategy::performCustomLowering(Function &F) {
@@ -123,9 +116,8 @@ bool GCStrategy::findCustomSafePoints(GC
GCFunctionInfo *GCStrategy::insertFunctionInfo(const Function &F) {
- GCFunctionInfo *FI = new GCFunctionInfo(F, *this);
- Functions.push_back(FI);
- return FI;
+ Functions.push_back(make_unique<GCFunctionInfo>(F, *this));
+ return Functions.back().get();
}
// -----------------------------------------------------------------------------
More information about the llvm-commits
mailing list