[llvm] r216916 - Correct unique_ptr passing in MCObjectDisassembler::setFallbackRegion

David Blaikie dblaikie at gmail.com
Tue Sep 2 10:29:52 PDT 2014

Author: dblaikie
Date: Tue Sep  2 12:29:51 2014
New Revision: 216916

URL: http://llvm.org/viewvc/llvm-project?rev=216916&view=rev
Correct unique_ptr passing in MCObjectDisassembler::setFallbackRegion

Rather than passing by lvalue reference, pass by value to ensure that
the caller provides an rvalue (and use move assignment, rather than
release+reset, to assign to the member variable)


Modified: llvm/trunk/include/llvm/MC/MCObjectDisassembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectDisassembler.h?rev=216916&r1=216915&r2=216916&view=diff
--- llvm/trunk/include/llvm/MC/MCObjectDisassembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectDisassembler.h Tue Sep  2 12:29:51 2014
@@ -66,8 +66,8 @@ public:
   /// \brief Set the region on which to fallback if disassembly was requested
   /// somewhere not accessible in the object file.
   /// This is used for dynamic disassembly (see RawMemoryObject).
-  void setFallbackRegion(std::unique_ptr<MemoryObject> &Region) {
-    FallbackRegion.reset(Region.release());
+  void setFallbackRegion(std::unique_ptr<MemoryObject> Region) {
+    FallbackRegion = std::move(Region);
   /// \brief Set the symbolizer to use to get information on external functions.

More information about the llvm-commits mailing list