diff options
| -rw-r--r-- | llvm/tools/bugpoint/CrashDebugger.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index a5766833b6e..54ed8c38d39 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -85,14 +85,14 @@ Expected<ReducePassList::TestResult> ReducePassList::doTest(std::vector<std::string> &Prefix, std::vector<std::string> &Suffix) { std::string PrefixOutput; - Module *OrigProgram = nullptr; + std::unique_ptr<Module> OrigProgram; if (!Prefix.empty()) { outs() << "Checking to see if these passes crash: " << getPassesString(Prefix) << ": "; if (BD.runPasses(BD.getProgram(), Prefix, PrefixOutput)) return KeepPrefix; - OrigProgram = BD.Program; + OrigProgram.reset(BD.Program); BD.Program = parseInputFile(PrefixOutput, BD.getContext()).release(); if (BD.Program == nullptr) { @@ -106,15 +106,13 @@ ReducePassList::doTest(std::vector<std::string> &Prefix, outs() << "Checking to see if these passes crash: " << getPassesString(Suffix) << ": "; - if (BD.runPasses(BD.getProgram(), Suffix)) { - delete OrigProgram; // The suffix crashes alone... - return KeepSuffix; - } + if (BD.runPasses(BD.getProgram(), Suffix)) + return KeepSuffix; // The suffix crashes alone... // Nothing failed, restore state... if (OrigProgram) { delete BD.Program; - BD.Program = OrigProgram; + BD.Program = OrigProgram.release(); } return NoFailure; } |

