diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-14 21:17:36 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-14 21:17:36 +0000 |
commit | f96e649d0150a51693157a216b570426de0a29be (patch) | |
tree | f59983f7ec0ca695b749273f21189ebda5951d2b /tools/bugpoint | |
parent | d86697c7307fae7f181533bff5b9c7c75c496f84 (diff) |
Use std::unique_ptr. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325174 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index fe50492f820..466293b89dc 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -316,17 +316,14 @@ ExtractLoops(BugDriver &BD, ValueToValueMapTy VMap; std::unique_ptr<Module> ToNotOptimize = CloneModule(*BD.getProgram(), VMap); - Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize.get(), - MiscompiledFunctions, VMap) - .release(); + std::unique_ptr<Module> ToOptimize = SplitFunctionsOutOfModule( + ToNotOptimize.get(), MiscompiledFunctions, VMap); std::unique_ptr<Module> ToOptimizeLoopExtracted = - BD.extractLoop(ToOptimize); - if (!ToOptimizeLoopExtracted) { + BD.extractLoop(ToOptimize.get()); + if (!ToOptimizeLoopExtracted) // If the loop extractor crashed or if there were no extractible loops, // then this chapter of our odyssey is over with. - delete ToOptimize; return MadeChange; - } errs() << "Extracted a loop from the breaking portion of the program.\n"; @@ -345,10 +342,9 @@ ExtractLoops(BugDriver &BD, return false; // Delete the original and set the new program. - Module *Old = BD.swapProgramIn(New->release()); + std::unique_ptr<Module> Old(BD.swapProgramIn(New->release())); for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i) MiscompiledFunctions[i] = cast<Function>(VMap[MiscompiledFunctions[i]]); - delete Old; if (Failure) { BD.switchToInterpreter(AI); @@ -361,16 +357,14 @@ ExtractLoops(BugDriver &BD, BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-tno.bc", ToNotOptimize.get()); BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to.bc", - ToOptimize); + ToOptimize.get()); BD.writeProgramToFile(OutputPrefix + "-loop-extract-fail-to-le.bc", ToOptimizeLoopExtracted.get()); errs() << "Please submit the " << OutputPrefix << "-loop-extract-fail-*.bc files.\n"; - delete ToOptimize; return MadeChange; } - delete ToOptimize; BD.switchToInterpreter(AI); outs() << " Testing after loop extraction:\n"; |