diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-14 19:58:41 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-14 19:58:41 +0000 |
commit | 2c8bcab6076a1b73fa0144a20e0347d9be78f907 (patch) | |
tree | a392285b836897e7809ad9ff518a553c435f1f19 /llvm/tools | |
parent | 02bb1747a34974e5be571f6d90a5e7ffb3983fb7 (diff) | |
download | bcm5719-llvm-2c8bcab6076a1b73fa0144a20e0347d9be78f907.tar.gz bcm5719-llvm-2c8bcab6076a1b73fa0144a20e0347d9be78f907.zip |
Use std::unique_ptr. NFC.
llvm-svn: 325163
Diffstat (limited to 'llvm/tools')
-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; } |