|
41 | 41 | #include "llvm/Target/TargetMachine.h"
|
42 | 42 | #include "llvm/Target/TargetRegisterInfo.h"
|
43 | 43 |
|
| 44 | +#include <memory> |
| 45 | + |
44 | 46 | using namespace llvm;
|
45 | 47 |
|
46 | 48 | static cl::opt<bool>
|
@@ -292,7 +294,7 @@ class LDVImpl {
|
292 | 294 | bool ModifiedMF;
|
293 | 295 |
|
294 | 296 | /// userValues - All allocated UserValue instances.
|
295 |
| - SmallVector<UserValue*, 8> userValues; |
| 297 | + SmallVector<std::unique_ptr<UserValue>, 8> userValues; |
296 | 298 |
|
297 | 299 | /// Map virtual register to eq class leader.
|
298 | 300 | typedef DenseMap<unsigned, UserValue*> VRMap;
|
@@ -332,7 +334,6 @@ class LDVImpl {
|
332 | 334 |
|
333 | 335 | /// clear - Release all memory.
|
334 | 336 | void clear() {
|
335 |
| - DeleteContainerPointers(userValues); |
336 | 337 | userValues.clear();
|
337 | 338 | virtRegToEqClass.clear();
|
338 | 339 | userVarMap.clear();
|
@@ -429,8 +430,9 @@ UserValue *LDVImpl::getUserValue(const MDNode *Var, unsigned Offset,
|
429 | 430 | return UV;
|
430 | 431 | }
|
431 | 432 |
|
432 |
| - UserValue *UV = new UserValue(Var, Offset, IsIndirect, DL, allocator); |
433 |
| - userValues.push_back(UV); |
| 433 | + userValues.push_back( |
| 434 | + make_unique<UserValue>(Var, Offset, IsIndirect, DL, allocator)); |
| 435 | + UserValue *UV = userValues.back().get(); |
434 | 436 | Leader = UserValue::merge(Leader, UV);
|
435 | 437 | return UV;
|
436 | 438 | }
|
|
0 commit comments