Просмотр исходного кода

Use copy initialization to initialize std::unique_ptr.

Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215867 91177308-0d34-0410-b5e6-96231b3b80d8
Rafael Espindola 11 лет назад
Родитель
Сommit
6de46b5183

+ 1 - 1
lib/ExecutionEngine/MCJIT/MCJIT.cpp

@@ -157,7 +157,7 @@ ObjectBufferStream* MCJIT::emitObject(Module *M) {
   if (ObjCache) {
     // MemoryBuffer is a thin wrapper around the actual memory, so it's OK
     // to create a temporary object here and delete it after the call.
-    std::unique_ptr<MemoryBuffer> MB(CompiledObject->getMemBuffer());
+    std::unique_ptr<MemoryBuffer> MB = CompiledObject->getMemBuffer();
     ObjCache->notifyObjectCompiled(M, MB.get());
   }
 

+ 1 - 1
lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h

@@ -48,7 +48,7 @@ public:
   {
     // FIXME: error checking? createObjectFile returns an ErrorOr<ObjectFile*>
     // and should probably be checked for failure.
-    std::unique_ptr<MemoryBuffer> Buf(Buffer->getMemBuffer());
+    std::unique_ptr<MemoryBuffer> Buf = Buffer->getMemBuffer();
     ObjFile = std::move(object::ObjectFile::createObjectFile(Buf).get());
   }
   ObjectImageCommon(std::unique_ptr<object::ObjectFile> Input)

+ 1 - 1
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

@@ -222,7 +222,7 @@ ObjectImage *RuntimeDyldELF::createObjectImage(ObjectBuffer *Buffer) {
                      (uint8_t)Buffer->getBufferStart()[ELF::EI_DATA]);
   std::error_code ec;
 
-  std::unique_ptr<MemoryBuffer> Buf(Buffer->getMemBuffer());
+  std::unique_ptr<MemoryBuffer> Buf = Buffer->getMemBuffer();
 
   if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB) {
     auto Obj =