@@ -1316,14 +1316,13 @@ LiveDebugVariablesAnalysis::run(MachineFunction &MF,
13161316 return LDV;
13171317}
13181318
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);
13221321}
13231322
13241323void LiveDebugVariables::releaseMemory () {
13251324 if (PImpl)
1326- static_cast <LDVImpl *>(PImpl)->clear ();
1325+ static_cast <LDVImpl *>(PImpl. get () )->clear ();
13271326}
13281327
13291328void LiveDebugVariables::analyze (MachineFunction &MF, LiveIntervals *LIS) {
@@ -1334,13 +1333,12 @@ void LiveDebugVariables::analyze(MachineFunction &MF, LiveIntervals *LIS) {
13341333 return ;
13351334 }
13361335
1337- if (!PImpl)
1338- PImpl = new LDVImpl (LIS); // reuse same object across analysis runs
1336+ PImpl.reset (new LDVImpl (LIS));
13391337
13401338 // Have we been asked to track variable locations using instruction
13411339 // referencing?
13421340 bool InstrRef = MF.useDebugInstrRef ();
1343- static_cast <LDVImpl *>(PImpl)->runOnMachineFunction (MF, InstrRef);
1341+ static_cast <LDVImpl *>(PImpl. get () )->runOnMachineFunction (MF, InstrRef);
13441342}
13451343
13461344// ===----------------------------------------------------------------------===//
@@ -1523,7 +1521,7 @@ void LDVImpl::splitRegister(Register OldReg, ArrayRef<Register> NewRegs) {
15231521void LiveDebugVariables::
15241522splitRegister (Register OldReg, ArrayRef<Register> NewRegs, LiveIntervals &LIS) {
15251523 if (PImpl)
1526- static_cast <LDVImpl *>(PImpl)->splitRegister (OldReg, NewRegs);
1524+ static_cast <LDVImpl *>(PImpl. get () )->splitRegister (OldReg, NewRegs);
15271525}
15281526
15291527void UserValue::rewriteLocations (VirtRegMap &VRM, const MachineFunction &MF,
@@ -1975,12 +1973,12 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
19751973
19761974void LiveDebugVariables::emitDebugValues (VirtRegMap *VRM) {
19771975 if (PImpl)
1978- static_cast <LDVImpl *>(PImpl)->emitDebugValues (VRM);
1976+ static_cast <LDVImpl *>(PImpl. get () )->emitDebugValues (VRM);
19791977}
19801978
19811979#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
19821980LLVM_DUMP_METHOD void LiveDebugVariables::dump () const {
19831981 if (PImpl)
1984- static_cast <LDVImpl *>(PImpl)->print (dbgs ());
1982+ static_cast <LDVImpl *>(PImpl. get () )->print (dbgs ());
19851983}
19861984#endif
0 commit comments