summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/Miscompilation.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-02-14 20:13:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-02-14 20:13:01 +0000
commit8b8d980bb94c72503948f87a202cd28b1e26cfb7 (patch)
tree5911ca5aa795c95b40f23e1e5b892edb6dea683b /llvm/tools/bugpoint/Miscompilation.cpp
parent2c8bcab6076a1b73fa0144a20e0347d9be78f907 (diff)
downloadbcm5719-llvm-8b8d980bb94c72503948f87a202cd28b1e26cfb7.tar.gz
bcm5719-llvm-8b8d980bb94c72503948f87a202cd28b1e26cfb7.zip
Use std::unique_ptr. NFC.
llvm-svn: 325164
Diffstat (limited to 'llvm/tools/bugpoint/Miscompilation.cpp')
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index a6ca65388d2..4661ffd9f90 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/tools/bugpoint/Miscompilation.cpp
@@ -577,23 +577,19 @@ ExtractBlocks(BugDriver &BD,
}
ValueToValueMapTy VMap;
- Module *ProgClone = CloneModule(*BD.getProgram(), VMap).release();
- Module *ToExtract =
- SplitFunctionsOutOfModule(ProgClone, MiscompiledFunctions, VMap)
- .release();
+ std::unique_ptr<Module> ProgClone = CloneModule(*BD.getProgram(), VMap);
+ std::unique_ptr<Module> ToExtract =
+ SplitFunctionsOutOfModule(ProgClone.get(), MiscompiledFunctions, VMap);
std::unique_ptr<Module> Extracted =
- BD.extractMappedBlocksFromModule(Blocks, ToExtract);
+ BD.extractMappedBlocksFromModule(Blocks, ToExtract.get());
if (!Extracted) {
// Weird, extraction should have worked.
errs() << "Nondeterministic problem extracting blocks??\n";
- delete ProgClone;
- delete ToExtract;
return false;
}
// Otherwise, block extraction succeeded. Link the two program fragments back
// together.
- delete ToExtract;
std::vector<std::pair<std::string, FunctionType *>> MisCompFunctions;
for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E;
@@ -605,7 +601,7 @@ ExtractBlocks(BugDriver &BD,
exit(1);
// Set the new program and delete the old one.
- BD.setNewProgram(ProgClone);
+ BD.setNewProgram(ProgClone.release());
// Update the list of miscompiled functions.
MiscompiledFunctions.clear();
OpenPOWER on IntegriCloud