Returning a std::unique_ptr is more constrained. Thanks to David Blaikie for the
suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215979
91177308-0d34-0410-b5e6-
96231b3b80d8
return 1;
int Res = 255;
- if (std::unique_ptr<llvm::Module> &Module = Act->getModule())
+ if (std::unique_ptr<llvm::Module> Module = Act->takeModule())
Res = Execute(std::move(Module), envp);
// Shutdown.
/// Take the generated LLVM module, for use after the action has been run.
/// The result may be null on failure.
- std::unique_ptr<llvm::Module> &getModule() { return TheModule; }
+ std::unique_ptr<llvm::Module> takeModule() { return std::move(TheModule); }
/// Take the LLVM context used by this action.
llvm::LLVMContext *takeLLVMContext();