summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-21 20:37:07 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-21 20:37:07 +0000
commit864c5312a7898da718f56db09e06040e60714970 (patch)
tree845cb78ba260b3ddeebcba8b80e9bb9acf20c409 /lib/CodeGen/LiveDebugVariables.cpp
parent52d629e1bc6352aee8563c55fbe6c0ff7f0bd32f (diff)
downloadllvm-864c5312a7898da718f56db09e06040e60714970.tar.gz
llvm-864c5312a7898da718f56db09e06040e60714970.tar.bz2
llvm-864c5312a7898da718f56db09e06040e60714970.tar.xz
Use unique_ptr to handle ownership of UserValues in LiveDebugVariablesImpl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--lib/CodeGen/LiveDebugVariables.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
index eb188cf10e..644ba232db 100644
--- a/lib/CodeGen/LiveDebugVariables.cpp
+++ b/lib/CodeGen/LiveDebugVariables.cpp
@@ -41,6 +41,8 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
+#include <memory>
+
using namespace llvm;
static cl::opt<bool>
@@ -292,7 +294,7 @@ class LDVImpl {
bool ModifiedMF;
/// userValues - All allocated UserValue instances.
- SmallVector<UserValue*, 8> userValues;
+ SmallVector<std::unique_ptr<UserValue>, 8> userValues;
/// Map virtual register to eq class leader.
typedef DenseMap<unsigned, UserValue*> VRMap;
@@ -332,7 +334,6 @@ public:
/// clear - Release all memory.
void clear() {
- DeleteContainerPointers(userValues);
userValues.clear();
virtRegToEqClass.clear();
userVarMap.clear();
@@ -429,8 +430,9 @@ UserValue *LDVImpl::getUserValue(const MDNode *Var, unsigned Offset,
return UV;
}
- UserValue *UV = new UserValue(Var, Offset, IsIndirect, DL, allocator);
- userValues.push_back(UV);
+ userValues.push_back(
+ make_unique<UserValue>(Var, Offset, IsIndirect, DL, allocator));
+ UserValue *UV = userValues.back().get();
Leader = UserValue::merge(Leader, UV);
return UV;
}