Use std::unique_ptr. NFC.
llvm-svn: 325165
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp
index 54ed8c3..bd542aa 100644
--- a/llvm/tools/bugpoint/CrashDebugger.cpp
+++ b/llvm/tools/bugpoint/CrashDebugger.cpp
@@ -242,7 +242,7 @@
// 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...
std::set<Function *> Functions;
@@ -301,19 +301,18 @@
}
// Finally, remove any null members from any global intrinsic.
- RemoveFunctionReferences(M, "llvm.used");
- RemoveFunctionReferences(M, "llvm.compiler.used");
+ RemoveFunctionReferences(M.get(), "llvm.used");
+ RemoveFunctionReferences(M.get(), "llvm.compiler.used");
}
// Try running 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 function pointers that point into the now-current
// module.
Funcs.assign(Functions.begin(), Functions.end());
return true;
}
- delete M;
return false;
}