[Lldb-commits] [PATCH] D57990: Use std::make_shared in LLDB (NFC)

Tatyana Krasnukha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 11 06:48:03 PST 2019


tatyana-krasnukha added a comment.

A few modernizations which though don't directly relate to make_shared:



================
Comment at: lldb/source/API/SBCommandInterpreter.cpp:560
   lldb::CommandObjectSP new_command_sp;
-  new_command_sp.reset(new CommandPluginInterfaceImplementation(
-      *m_opaque_ptr, name, impl, help));
+  new_command_sp = std::make_shared<CommandPluginInterfaceImplementation>(
+      *m_opaque_ptr, name, impl, help);
----------------
Why not replace assignment with initialization here and below?


================
Comment at: lldb/source/Target/Thread.cpp:1611
     m_curr_frames_sp = frame_list_sp;
   }
   return frame_list_sp;
----------------
This 'if-else' block may be replaced with

```
  if (!m_curr_frames_sp)
    m_curr_frames_sp =
        std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
  frame_list_sp = m_curr_frames_sp;
```


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57990/new/

https://reviews.llvm.org/D57990





More information about the lldb-commits mailing list