diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-11-09 23:21:04 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-11-09 23:21:04 +0000 |
commit | 2ef442c639dcf6211bb779402cf6bbe102e2fbaa (patch) | |
tree | c67191b63decbbba8e9e7dbf3a1de2099ec1592d /lldb/source/API/SBStructuredData.cpp | |
parent | 8183718cb1a6e137efc61c93bd3f4b89678de008 (diff) | |
download | bcm5719-llvm-2ef442c639dcf6211bb779402cf6bbe102e2fbaa.tar.gz bcm5719-llvm-2ef442c639dcf6211bb779402cf6bbe102e2fbaa.zip |
Fix weak symbol linkage in SBStructuredData, update docs.
Summary:
This change fixes an issue where I was leaking a weakly-linked symbol in
the SBAPI. It also updates the docs to call out what I did wrong.
Fixes:
rdar://28882483
Reviewers: jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D26470
llvm-svn: 286413
Diffstat (limited to 'lldb/source/API/SBStructuredData.cpp')
-rw-r--r-- | lldb/source/API/SBStructuredData.cpp | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/lldb/source/API/SBStructuredData.cpp b/lldb/source/API/SBStructuredData.cpp index 3c04b3bbba9..d9ea072186a 100644 --- a/lldb/source/API/SBStructuredData.cpp +++ b/lldb/source/API/SBStructuredData.cpp @@ -20,23 +20,23 @@ using namespace lldb; using namespace lldb_private; #pragma mark-- -#pragma mark Impl +#pragma mark StructuredDataImpl -class SBStructuredData::Impl { +class StructuredDataImpl { public: - Impl() : m_plugin_wp(), m_data_sp() {} + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} - Impl(const Impl &rhs) = default; + StructuredDataImpl(const StructuredDataImpl &rhs) = default; - Impl(const EventSP &event_sp) + StructuredDataImpl(const EventSP &event_sp) : m_plugin_wp( EventDataStructuredData::GetPluginFromEvent(event_sp.get())), m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { } - ~Impl() = default; + ~StructuredDataImpl() = default; - Impl &operator=(const Impl &rhs) = default; + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; bool IsValid() const { return m_data_sp.get() != nullptr; } @@ -45,7 +45,7 @@ public: m_data_sp.reset(); } - SBError GetAsJSON(lldb::SBStream &stream) const { + SBError GetAsJSON(lldb_private::Stream &stream) const { SBError sb_error; if (!m_data_sp) { @@ -53,33 +53,29 @@ public: return sb_error; } - m_data_sp->Dump(stream.ref()); + m_data_sp->Dump(stream); return sb_error; } - lldb::SBError GetDescription(lldb::SBStream &stream) const { - SBError sb_error; + Error GetDescription(lldb_private::Stream &stream) const { + Error error; if (!m_data_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; } // Grab the plugin. auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); if (!plugin_sp) { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; } // Get the data's description. - auto error = plugin_sp->GetDescription(m_data_sp, stream.ref()); - if (!error.Success()) - sb_error.SetError(error); - - return sb_error; + return plugin_sp->GetDescription(m_data_sp, stream); } private: @@ -90,13 +86,13 @@ private: #pragma mark-- #pragma mark SBStructuredData -SBStructuredData::SBStructuredData() : m_impl_up(new Impl()) {} +SBStructuredData::SBStructuredData() : m_impl_up(new StructuredDataImpl()) {} SBStructuredData::SBStructuredData(const lldb::SBStructuredData &rhs) - : m_impl_up(new Impl(*rhs.m_impl_up.get())) {} + : m_impl_up(new StructuredDataImpl(*rhs.m_impl_up.get())) {} SBStructuredData::SBStructuredData(const lldb::EventSP &event_sp) - : m_impl_up(new Impl(event_sp)) {} + : m_impl_up(new StructuredDataImpl(event_sp)) {} SBStructuredData::~SBStructuredData() {} @@ -111,9 +107,12 @@ bool SBStructuredData::IsValid() const { return m_impl_up->IsValid(); } void SBStructuredData::Clear() { m_impl_up->Clear(); } SBError SBStructuredData::GetAsJSON(lldb::SBStream &stream) const { - return m_impl_up->GetAsJSON(stream); + return m_impl_up->GetAsJSON(stream.ref()); } lldb::SBError SBStructuredData::GetDescription(lldb::SBStream &stream) const { - return m_impl_up->GetDescription(stream); + Error error = m_impl_up->GetDescription(stream.ref()); + SBError sb_error; + sb_error.SetError(error); + return sb_error; } |