@@ -1316,14 +1316,13 @@ LiveDebugVariablesAnalysis::run(MachineFunction &MF,
1316
1316
return LDV;
1317
1317
}
1318
1318
1319
- LiveDebugVariables::~LiveDebugVariables () {
1320
- if (PImpl)
1321
- delete static_cast <LDVImpl *>(PImpl);
1319
+ void LiveDebugVariables::Deleter::operator ()(void *Ptr) const {
1320
+ delete static_cast <LDVImpl *>(Ptr);
1322
1321
}
1323
1322
1324
1323
void LiveDebugVariables::releaseMemory () {
1325
1324
if (PImpl)
1326
- static_cast <LDVImpl *>(PImpl)->clear ();
1325
+ static_cast <LDVImpl *>(PImpl. get () )->clear ();
1327
1326
}
1328
1327
1329
1328
void LiveDebugVariables::analyze (MachineFunction &MF, LiveIntervals *LIS) {
@@ -1334,13 +1333,12 @@ void LiveDebugVariables::analyze(MachineFunction &MF, LiveIntervals *LIS) {
1334
1333
return ;
1335
1334
}
1336
1335
1337
- if (!PImpl)
1338
- PImpl = new LDVImpl (LIS); // reuse same object across analysis runs
1336
+ PImpl.reset (new LDVImpl (LIS));
1339
1337
1340
1338
// Have we been asked to track variable locations using instruction
1341
1339
// referencing?
1342
1340
bool InstrRef = MF.useDebugInstrRef ();
1343
- static_cast <LDVImpl *>(PImpl)->runOnMachineFunction (MF, InstrRef);
1341
+ static_cast <LDVImpl *>(PImpl. get () )->runOnMachineFunction (MF, InstrRef);
1344
1342
}
1345
1343
1346
1344
// ===----------------------------------------------------------------------===//
@@ -1523,7 +1521,7 @@ void LDVImpl::splitRegister(Register OldReg, ArrayRef<Register> NewRegs) {
1523
1521
void LiveDebugVariables::
1524
1522
splitRegister (Register OldReg, ArrayRef<Register> NewRegs, LiveIntervals &LIS) {
1525
1523
if (PImpl)
1526
- static_cast <LDVImpl *>(PImpl)->splitRegister (OldReg, NewRegs);
1524
+ static_cast <LDVImpl *>(PImpl. get () )->splitRegister (OldReg, NewRegs);
1527
1525
}
1528
1526
1529
1527
void UserValue::rewriteLocations (VirtRegMap &VRM, const MachineFunction &MF,
@@ -1975,12 +1973,12 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
1975
1973
1976
1974
void LiveDebugVariables::emitDebugValues (VirtRegMap *VRM) {
1977
1975
if (PImpl)
1978
- static_cast <LDVImpl *>(PImpl)->emitDebugValues (VRM);
1976
+ static_cast <LDVImpl *>(PImpl. get () )->emitDebugValues (VRM);
1979
1977
}
1980
1978
1981
1979
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1982
1980
LLVM_DUMP_METHOD void LiveDebugVariables::dump () const {
1983
1981
if (PImpl)
1984
- static_cast <LDVImpl *>(PImpl)->print (dbgs ());
1982
+ static_cast <LDVImpl *>(PImpl. get () )->print (dbgs ());
1985
1983
}
1986
1984
#endif
0 commit comments