From: Rafael Espindola Date: Tue, 19 Aug 2014 14:32:16 +0000 (+0000) Subject: Go back to having a takeModule instead of a getModule. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=932979df3c69c000de68b949469cb653a6de2182;p=clang Go back to having a takeModule instead of a getModule. 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 --- diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp index 5cc5d524f1..60cb704107 100644 --- a/examples/clang-interpreter/main.cpp +++ b/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/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h index 282202184b..2408bc4f9e 100644 --- a/include/clang/CodeGen/CodeGenAction.h +++ b/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();