mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user