[llvm] r325173 - Use std::unique_ptr. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 13:10:30 PST 2018
Author: rafael
Date: Wed Feb 14 13:10:29 2018
New Revision: 325173
URL: http://llvm.org/viewvc/llvm-project?rev=325173&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=325173&r1=325172&r2=325173&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Wed Feb 14 13:10:29 2018
@@ -243,10 +243,9 @@ static Expected<std::unique_ptr<Module>>
return std::move(Merged);
}
-/// TestFuncs - split functions in a Module into two groups: those that are
-/// under consideration for miscompilation vs. those that are not, and test
+/// split functions in a Module into two groups: those that are under
+/// consideration for miscompilation vs. those that are not, and test
/// accordingly. Each group of functions becomes a separate Module.
-///
Expected<bool>
ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function *> &Funcs) {
// Test to see if the function is misoptimized if we ONLY run it on the
@@ -266,8 +265,8 @@ ReduceMiscompilingFunctions::TestFuncs(c
// we can conclude that a function triggers the bug when in fact one
// needs a larger set of original functions to do so.
ValueToValueMapTy VMap;
- Module *Clone = CloneModule(*BD.getProgram(), VMap).release();
- Module *Orig = BD.swapProgramIn(Clone);
+ std::unique_ptr<Module> Clone = CloneModule(*BD.getProgram(), VMap);
+ std::unique_ptr<Module> Orig(BD.swapProgramIn(Clone.release()));
std::vector<Function *> FuncsOnClone;
for (unsigned i = 0, e = Funcs.size(); i != e; ++i) {
@@ -284,7 +283,7 @@ ReduceMiscompilingFunctions::TestFuncs(c
Expected<bool> Broken =
TestFn(BD, std::move(ToOptimize), std::move(ToNotOptimize));
- delete BD.swapProgramIn(Orig);
+ delete BD.swapProgramIn(Orig.release());
return Broken;
}
More information about the llvm-commits
mailing list