[lld] r233319 - Use llvm::make_unique.

Rui Ueyama ruiu at google.com
Thu Mar 26 14:16:27 PDT 2015


Author: ruiu
Date: Thu Mar 26 16:16:26 2015
New Revision: 233319

URL: http://llvm.org/viewvc/llvm-project?rev=233319&view=rev
Log:
Use llvm::make_unique.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
    lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
    lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
    lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h

Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp Thu Mar 26 16:16:26 2015
@@ -29,12 +29,11 @@ void AArch64TargetHandler::registerReloc
 std::unique_ptr<Writer> AArch64TargetHandler::getWriter() {
   switch (this->_context.getOutputELFType()) {
   case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(new AArch64ExecutableWriter<AArch64ELFType>(
-        _context, *_AArch64TargetLayout.get()));
+    return llvm::make_unique<AArch64ExecutableWriter<AArch64ELFType>>(
+        _context, *_AArch64TargetLayout.get());
   case llvm::ELF::ET_DYN:
-    return std::unique_ptr<Writer>(
-        new AArch64DynamicLibraryWriter<AArch64ELFType>(
-            _context, *_AArch64TargetLayout.get()));
+    return llvm::make_unique<AArch64DynamicLibraryWriter<AArch64ELFType>>(
+        _context, *_AArch64TargetLayout.get());
   case llvm::ELF::ET_REL:
     llvm_unreachable("TODO: support -r mode");
   default:

Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp Thu Mar 26 16:16:26 2015
@@ -29,8 +29,8 @@ void ARMTargetHandler::registerRelocatio
 std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
   switch (this->_context.getOutputELFType()) {
   case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(
-        new ARMExecutableWriter<ARMELFType>(_context, *_armTargetLayout.get()));
+    return llvm::make_unique<ARMExecutableWriter<ARMELFType>>(
+        _context, *_armTargetLayout.get());
   default:
     llvm_unreachable("unsupported output type");
   }

Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp Thu Mar 26 16:16:26 2015
@@ -28,13 +28,11 @@ HexagonTargetHandler::HexagonTargetHandl
 std::unique_ptr<Writer> HexagonTargetHandler::getWriter() {
   switch (_hexagonLinkingContext.getOutputELFType()) {
   case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(
-        new elf::HexagonExecutableWriter<HexagonELFType>(
-            _hexagonLinkingContext, *_hexagonTargetLayout.get()));
+    return llvm::make_unique<HexagonExecutableWriter<HexagonELFType>>(
+        _hexagonLinkingContext, *_hexagonTargetLayout.get());
   case llvm::ELF::ET_DYN:
-    return std::unique_ptr<Writer>(
-        new elf::HexagonDynamicLibraryWriter<HexagonELFType>(
-            _hexagonLinkingContext, *_hexagonTargetLayout.get()));
+    return llvm::make_unique<HexagonDynamicLibraryWriter<HexagonELFType>>(
+        _hexagonLinkingContext, *_hexagonTargetLayout.get());
   case llvm::ELF::ET_REL:
     llvm_unreachable("TODO: support -r mode");
   default:

Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h Thu Mar 26 16:16:26 2015
@@ -116,11 +116,11 @@ public:
   MipsTargetLayout<ELFT> &getTargetLayout() override { return *_targetLayout; }
 
   std::unique_ptr<Reader> getObjReader() override {
-    return std::unique_ptr<Reader>(new MipsELFObjectReader<ELFT>(_ctx));
+    return llvm::make_unique<MipsELFObjectReader<ELFT>>(_ctx);
   }
 
   std::unique_ptr<Reader> getDSOReader() override {
-    return std::unique_ptr<Reader>(new MipsELFDSOReader<ELFT>(_ctx));
+    return llvm::make_unique<MipsELFDSOReader<ELFT>>(_ctx);
   }
 
   const TargetRelocationHandler &getRelocationHandler() const override {
@@ -130,11 +130,11 @@ public:
   std::unique_ptr<Writer> getWriter() override {
     switch (_ctx.getOutputELFType()) {
     case llvm::ELF::ET_EXEC:
-      return std::unique_ptr<Writer>(
-          new MipsExecutableWriter<ELFT>(_ctx, *_targetLayout));
+      return llvm::make_unique<MipsExecutableWriter<ELFT>>(
+          _ctx, *_targetLayout);
     case llvm::ELF::ET_DYN:
-      return std::unique_ptr<Writer>(
-          new MipsDynamicLibraryWriter<ELFT>(_ctx, *_targetLayout));
+      return llvm::make_unique<MipsDynamicLibraryWriter<ELFT>>(
+          _ctx, *_targetLayout);
     case llvm::ELF::ET_REL:
       llvm_unreachable("TODO: support -r mode");
     default:

Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp Thu Mar 26 16:16:26 2015
@@ -21,11 +21,11 @@ using namespace llvm::ELF;
 std::unique_ptr<Writer> X86TargetHandler::getWriter() {
   switch (_x86LinkingContext.getOutputELFType()) {
   case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(new X86ExecutableWriter<X86ELFType>(
-        _x86LinkingContext, *_x86TargetLayout.get()));
+    return llvm::make_unique<X86ExecutableWriter<X86ELFType>>(
+        _x86LinkingContext, *_x86TargetLayout.get());
   case llvm::ELF::ET_DYN:
-    return std::unique_ptr<Writer>(new X86DynamicLibraryWriter<X86ELFType>(
-        _x86LinkingContext, *_x86TargetLayout.get()));
+    return llvm::make_unique<X86DynamicLibraryWriter<X86ELFType>>(
+        _x86LinkingContext, *_x86TargetLayout.get());
   case llvm::ELF::ET_REL:
     llvm_unreachable("TODO: support -r mode");
   default:

Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h Thu Mar 26 16:16:26 2015
@@ -42,11 +42,11 @@ public:
   }
 
   std::unique_ptr<Reader> getObjReader() override {
-    return std::unique_ptr<Reader>(new X86ELFObjectReader(_x86LinkingContext));
+    return llvm::make_unique<X86ELFObjectReader>(_x86LinkingContext);
   }
 
   std::unique_ptr<Reader> getDSOReader() override {
-    return std::unique_ptr<Reader>(new X86ELFDSOReader(_x86LinkingContext));
+    return llvm::make_unique<X86ELFDSOReader>(_x86LinkingContext);
   }
 
   std::unique_ptr<Writer> getWriter() override;

Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp Thu Mar 26 16:16:26 2015
@@ -29,11 +29,11 @@ void X86_64TargetHandler::registerReloca
 std::unique_ptr<Writer> X86_64TargetHandler::getWriter() {
   switch (this->_context.getOutputELFType()) {
   case llvm::ELF::ET_EXEC:
-    return std::unique_ptr<Writer>(
-        new X86_64ExecutableWriter(_context, *_x86_64TargetLayout.get()));
+    return llvm::make_unique<X86_64ExecutableWriter>(
+        _context, *_x86_64TargetLayout.get());
   case llvm::ELF::ET_DYN:
-    return std::unique_ptr<Writer>(
-        new X86_64DynamicLibraryWriter(_context, *_x86_64TargetLayout.get()));
+    return llvm::make_unique<X86_64DynamicLibraryWriter>(
+        _context, *_x86_64TargetLayout.get());
   case llvm::ELF::ET_REL:
     llvm_unreachable("TODO: support -r mode");
   default:

Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h?rev=233319&r1=233318&r2=233319&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h Thu Mar 26 16:16:26 2015
@@ -47,11 +47,11 @@ public:
   }
 
   std::unique_ptr<Reader> getObjReader() override {
-    return std::unique_ptr<Reader>(new X86_64ELFObjectReader(_context));
+    return llvm::make_unique<X86_64ELFObjectReader>(_context);
   }
 
   std::unique_ptr<Reader> getDSOReader() override {
-    return std::unique_ptr<Reader>(new X86_64ELFDSOReader(_context));
+    return llvm::make_unique<X86_64ELFDSOReader>(_context);
   }
 
   std::unique_ptr<Writer> getWriter() override;





More information about the llvm-commits mailing list