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 | 54c64ed3c07edfae2e676c3aa2e57abc67459539 (patch) | |
| tree | 260655d211c26f641787c98b40e2e3e312c0cf9c /llvm/tools/bugpoint | |
| parent | a7b0794042e3857f5cd12cdde747fa57ee3a39e8 (diff) | |
| download | bcm5719-llvm-54c64ed3c07edfae2e676c3aa2e57abc67459539.tar.gz bcm5719-llvm-54c64ed3c07edfae2e676c3aa2e57abc67459539.zip | |
Use std::unique_ptr. NFC.
llvm-svn: 325174
Diffstat (limited to 'llvm/tools/bugpoint')
| -rw-r--r-- | llvm/tools/bugpoint/Miscompilation.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp index fe50492f820..466293b89dc 100644 --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/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"; |

