[Lldb-commits] [lldb] r313265 - Remove uses of std::auto_ptr, it's going away in C++17.

Benjamin Kramer via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 14 08:01:55 PDT 2017


Author: d0k
Date: Thu Sep 14 08:01:55 2017
New Revision: 313265

URL: http://llvm.org/viewvc/llvm-project?rev=313265&view=rev
Log:
Remove uses of std::auto_ptr, it's going away in C++17.

std::unique_ptr is pretty much a drop-in replacement here. Also remove nullptr
checks that are doing nothing.

Modified:
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
    lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
    lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=313265&r1=313264&r2=313265&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Thu Sep 14 08:01:55 2017
@@ -1146,7 +1146,7 @@ public:
       const char *text = m_delegate_sp->WindowDelegateGetHelpText();
       KeyHelp *key_help = m_delegate_sp->WindowDelegateGetKeyHelp();
       if ((text && text[0]) || key_help) {
-        std::auto_ptr<HelpDialogDelegate> help_delegate_ap(
+        std::unique_ptr<HelpDialogDelegate> help_delegate_ap(
             new HelpDialogDelegate(text, key_help));
         const size_t num_lines = help_delegate_ap->GetNumLines();
         const size_t max_length = help_delegate_ap->GetMaxLineLength();

Modified: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=313265&r1=313264&r2=313265&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Thu Sep 14 08:01:55 2017
@@ -167,10 +167,7 @@ EmulateInstructionARM64::CreateInstance(
   if (EmulateInstructionARM64::SupportsEmulatingInstructionsOfTypeStatic(
           inst_type)) {
     if (arch.GetTriple().getArch() == llvm::Triple::aarch64) {
-      std::auto_ptr<EmulateInstructionARM64> emulate_insn_ap(
-          new EmulateInstructionARM64(arch));
-      if (emulate_insn_ap.get())
-        return emulate_insn_ap.release();
+      return new EmulateInstructionARM64(arch);
     }
   }
 

Modified: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp?rev=313265&r1=313264&r2=313265&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp Thu Sep 14 08:01:55 2017
@@ -212,10 +212,7 @@ EmulateInstructionMIPS::CreateInstance(c
           inst_type)) {
     if (arch.GetTriple().getArch() == llvm::Triple::mips ||
         arch.GetTriple().getArch() == llvm::Triple::mipsel) {
-      std::auto_ptr<EmulateInstructionMIPS> emulate_insn_ap(
-          new EmulateInstructionMIPS(arch));
-      if (emulate_insn_ap.get())
-        return emulate_insn_ap.release();
+      return new EmulateInstructionMIPS(arch);
     }
   }
 

Modified: lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp?rev=313265&r1=313264&r2=313265&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp Thu Sep 14 08:01:55 2017
@@ -199,10 +199,7 @@ EmulateInstructionMIPS64::CreateInstance
           inst_type)) {
     if (arch.GetTriple().getArch() == llvm::Triple::mips64 ||
         arch.GetTriple().getArch() == llvm::Triple::mips64el) {
-      std::auto_ptr<EmulateInstructionMIPS64> emulate_insn_ap(
-          new EmulateInstructionMIPS64(arch));
-      if (emulate_insn_ap.get())
-        return emulate_insn_ap.release();
+      return new EmulateInstructionMIPS64(arch);
     }
   }
 

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=313265&r1=313264&r2=313265&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Sep 14 08:01:55 2017
@@ -451,7 +451,7 @@ ObjectFile *ObjectFileELF::CreateMemoryI
     if (ELFHeader::MagicBytesMatch(magic)) {
       unsigned address_size = ELFHeader::AddressSizeInBytes(magic);
       if (address_size == 4 || address_size == 8) {
-        std::auto_ptr<ObjectFileELF> objfile_ap(
+        std::unique_ptr<ObjectFileELF> objfile_ap(
             new ObjectFileELF(module_sp, data_sp, process_sp, header_addr));
         ArchSpec spec;
         if (objfile_ap->GetArchitecture(spec) &&




More information about the lldb-commits mailing list