[llvm] r325164 - Use std::unique_ptr. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 12:13:02 PST 2018
Author: rafael
Date: Wed Feb 14 12:13:01 2018
New Revision: 325164
URL: http://llvm.org/viewvc/llvm-project?rev=325164&view=rev
Log:
Use std::unique_ptr. NFC.
Modified:
llvm/trunk/tools/bugpoint/Miscompilation.cpp
Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=325164&r1=325163&r2=325164&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Wed Feb 14 12:13:01 2018
@@ -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();
More information about the llvm-commits
mailing list