[llvm] r325167 - Use std::unique_ptr. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 12:25:18 PST 2018
Author: rafael
Date: Wed Feb 14 12:25:18 2018
New Revision: 325167
URL: http://llvm.org/viewvc/llvm-project?rev=325167&view=rev
Log:
Use std::unique_ptr. NFC.
Modified:
llvm/trunk/tools/bugpoint/CrashDebugger.cpp
Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=325167&r1=325166&r2=325167&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
+++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Wed Feb 14 12:25:18 2018
@@ -700,7 +700,7 @@ bool ReduceCrashingInstructions::TestIns
std::vector<const Instruction *> &Insts) {
// Clone the program to try hacking it apart...
ValueToValueMapTy VMap;
- Module *M = CloneModule(*BD.getProgram(), VMap).release();
+ std::unique_ptr<Module> M = CloneModule(*BD.getProgram(), VMap);
// Convert list to set for fast lookup...
SmallPtrSet<Instruction *, 32> Instructions;
@@ -734,8 +734,8 @@ bool ReduceCrashingInstructions::TestIns
Passes.run(*M);
// Try running on the hacked up program...
- if (TestFn(BD, M)) {
- BD.setNewProgram(M); // It crashed, keep the trimmed version...
+ if (TestFn(BD, M.get())) {
+ BD.setNewProgram(M.release()); // It crashed, keep the trimmed version...
// Make sure to use instruction pointers that point into the now-current
// module, and that they don't include any deleted blocks.
@@ -744,7 +744,7 @@ bool ReduceCrashingInstructions::TestIns
Insts.push_back(Inst);
return true;
}
- delete M; // It didn't crash, try something else.
+ // It didn't crash, try something else.
return false;
}
More information about the llvm-commits
mailing list