]> granicus.if.org Git - clang/commitdiff
Go back to having a takeModule instead of a getModule.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 19 Aug 2014 14:32:16 +0000 (14:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 19 Aug 2014 14:32:16 +0000 (14:32 +0000)
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

examples/clang-interpreter/main.cpp
include/clang/CodeGen/CodeGenAction.h

index 5cc5d524f19c031c1c134ff5240e5f18283d207d..60cb70410700ac94aa008a48eb01bffa43517ffc 100644 (file)
@@ -165,7 +165,7 @@ int main(int argc, const char **argv, char * const *envp) {
     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.
index 282202184b6b097b7b21fc64674ec8afe51b2e85..2408bc4f9e7cc7e075e0a7acb188957bfda7bae5 100644 (file)
@@ -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<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();