diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2023-02-09 17:24:10 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2023-02-09 21:42:25 -0800 |
commit | 125e69015addb656bccaf1c48ea006c9742cda25 (patch) | |
tree | 3ae785c65ee166b9f1bc99fe17b78af48cddc107 /lldb/source/API/SBDebugger.cpp | |
parent | dc4c3cfd78c01bef427fca0431fe66a6c6de7c35 (diff) | |
download | llvm-125e69015addb656bccaf1c48ea006c9742cda25.zip llvm-125e69015addb656bccaf1c48ea006c9742cda25.tar.gz llvm-125e69015addb656bccaf1c48ea006c9742cda25.tar.bz2 |
[lldb] Hoist code to create StructuredData into DiagnosticEventData (NFC)
Hoist the code that creates a StructuredData dictionary from a
diagnostic event into the DiagnosticEventData. This addresses Ismail's
code review feedback from D143687.
Differential revision: https://reviews.llvm.org/D143694
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 851c80a..be86078 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -172,19 +172,14 @@ lldb::SBStructuredData SBDebugger::GetDiagnosticFromEvent(const lldb::SBEvent &event) { LLDB_INSTRUMENT_VA(event); - const DiagnosticEventData *diagnostic_data = - DiagnosticEventData::GetEventDataFromEvent(event.get()); - if (!diagnostic_data) - return {}; + StructuredData::DictionarySP dictionary_sp = + DiagnosticEventData::GetAsStructuredData(event.get()); - auto dictionary = std::make_unique<StructuredData::Dictionary>(); - dictionary->AddStringItem("message", diagnostic_data->GetMessage()); - dictionary->AddStringItem("type", diagnostic_data->GetPrefix()); - dictionary->AddBooleanItem("debugger_specific", - diagnostic_data->IsDebuggerSpecific()); + if (!dictionary_sp) + return {}; SBStructuredData data; - data.m_impl_up->SetObjectSP(std::move(dictionary)); + data.m_impl_up->SetObjectSP(std::move(dictionary_sp)); return data; } |