diff --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp index 5cc5d524f19c..60cb70410700 100644 --- a/clang/examples/clang-interpreter/main.cpp +++ b/clang/examples/clang-interpreter/main.cpp @@ -165,7 +165,7 @@ int main(int argc, const char **argv, char * const *envp) { return 1; int Res = 255; - if (std::unique_ptr &Module = Act->getModule()) + if (std::unique_ptr Module = Act->takeModule()) Res = Execute(std::move(Module), envp); // Shutdown. diff --git a/clang/include/clang/CodeGen/CodeGenAction.h b/clang/include/clang/CodeGen/CodeGenAction.h index 282202184b6b..2408bc4f9e7c 100644 --- a/clang/include/clang/CodeGen/CodeGenAction.h +++ b/clang/include/clang/CodeGen/CodeGenAction.h @@ -54,7 +54,7 @@ public: /// Take the generated LLVM module, for use after the action has been run. /// The result may be null on failure. - std::unique_ptr &getModule() { return TheModule; } + std::unique_ptr takeModule() { return std::move(TheModule); } /// Take the LLVM context used by this action. llvm::LLVMContext *takeLLVMContext();