[Lldb-commits] [PATCH] D88266: Check that the "StructuredData Plugin weak pointer" is good before trying to turn it into a shared pointer

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 24 16:53:18 PDT 2020


clayborg added a comment.

So StructuredData::Object does have a dump function:

  void Object::Dump(lldb_private::Stream &s, bool pretty_print = true) const;

Not sure when that got added. So we actually don't even need the m_plugin_wp anymore if we switch to using that?



================
Comment at: lldb/include/lldb/Core/StructuredDataImpl.h:72-85
+    if (m_plugin_wp.expired()) {
+      error.SetErrorString("Cannot pretty print structured data: "
+                           "plugin is expired.");
+      return error;    
+    }
     auto plugin_sp = lldb::StructuredDataPluginSP(m_plugin_wp);
     if (!plugin_sp) {
----------------
All of this could become:

```
m_data_sp->Dump(stream);
```
And we can get rid of m_plugin_wp from this class?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88266



More information about the lldb-commits mailing list