diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-26 17:19:03 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-26 17:19:03 +0000 |
commit | 28b351a56dce9c633e97cdf2762b23b136642c94 (patch) | |
tree | 918591212c345b3e2957abab05472c57d59a61d5 /llvm/tools/bugpoint/OptimizerDriver.cpp | |
parent | d71a5c727716e542faf2494cf16fe285883d7cfc (diff) | |
download | bcm5719-llvm-28b351a56dce9c633e97cdf2762b23b136642c94.tar.gz bcm5719-llvm-28b351a56dce9c633e97cdf2762b23b136642c94.zip |
Return a std::unique_ptr from parseInputFile and propagate. NFC.
The memory management in BugPoint is fairly convoluted, so this just unwraps
one layer by changing the return type of functions that always return
owned Modules.
llvm-svn: 216464
Diffstat (limited to 'llvm/tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r-- | llvm/tools/bugpoint/OptimizerDriver.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp index c75f82f17dc..3854aa1e5bf 100644 --- a/llvm/tools/bugpoint/OptimizerDriver.cpp +++ b/llvm/tools/bugpoint/OptimizerDriver.cpp @@ -247,13 +247,10 @@ bool BugDriver::runPasses(Module *Program, } -/// runPassesOn - Carefully run the specified set of pass on the specified -/// module, returning the transformed module on success, or a null pointer on -/// failure. -Module *BugDriver::runPassesOn(Module *M, - const std::vector<std::string> &Passes, - bool AutoDebugCrashes, unsigned NumExtraArgs, - const char * const *ExtraArgs) { +std::unique_ptr<Module> +BugDriver::runPassesOn(Module *M, const std::vector<std::string> &Passes, + bool AutoDebugCrashes, unsigned NumExtraArgs, + const char *const *ExtraArgs) { std::string BitcodeResult; if (runPasses(M, Passes, BitcodeResult, false/*delete*/, true/*quiet*/, NumExtraArgs, ExtraArgs)) { @@ -267,7 +264,7 @@ Module *BugDriver::runPassesOn(Module *M, return nullptr; } - Module *Ret = ParseInputFile(BitcodeResult, Context); + std::unique_ptr<Module> Ret = parseInputFile(BitcodeResult, Context); if (!Ret) { errs() << getToolName() << ": Error reading bitcode file '" << BitcodeResult << "'!\n"; |