File tree Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 9
9
#include " lldb/Core/ModuleSpec.h"
10
10
#include " lldb/Utility/ConstString.h"
11
11
#include " lldb/Utility/Event.h"
12
+ #include " lldb/Utility/StructuredData.h"
12
13
13
14
#include < string>
14
15
@@ -75,6 +76,9 @@ class DiagnosticEventData : public EventData {
75
76
static const DiagnosticEventData *
76
77
GetEventDataFromEvent (const Event *event_ptr);
77
78
79
+ static StructuredData::DictionarySP
80
+ GetAsStructuredData (const Event *event_ptr);
81
+
78
82
protected:
79
83
std::string m_message;
80
84
Type m_type;
Original file line number Diff line number Diff line change @@ -172,19 +172,14 @@ lldb::SBStructuredData
172
172
SBDebugger::GetDiagnosticFromEvent (const lldb::SBEvent &event) {
173
173
LLDB_INSTRUMENT_VA (event);
174
174
175
- const DiagnosticEventData *diagnostic_data =
176
- DiagnosticEventData::GetEventDataFromEvent (event.get ());
177
- if (!diagnostic_data)
178
- return {};
175
+ StructuredData::DictionarySP dictionary_sp =
176
+ DiagnosticEventData::GetAsStructuredData (event.get ());
179
177
180
- auto dictionary = std::make_unique<StructuredData::Dictionary>();
181
- dictionary->AddStringItem (" message" , diagnostic_data->GetMessage ());
182
- dictionary->AddStringItem (" type" , diagnostic_data->GetPrefix ());
183
- dictionary->AddBooleanItem (" debugger_specific" ,
184
- diagnostic_data->IsDebuggerSpecific ());
178
+ if (!dictionary_sp)
179
+ return {};
185
180
186
181
SBStructuredData data;
187
- data.m_impl_up ->SetObjectSP (std::move (dictionary ));
182
+ data.m_impl_up ->SetObjectSP (std::move (dictionary_sp ));
188
183
return data;
189
184
}
190
185
Original file line number Diff line number Diff line change @@ -85,6 +85,22 @@ DiagnosticEventData::GetEventDataFromEvent(const Event *event_ptr) {
85
85
return GetEventDataFromEventImpl<DiagnosticEventData>(event_ptr);
86
86
}
87
87
88
+ StructuredData::DictionarySP
89
+ DiagnosticEventData::GetAsStructuredData (const Event *event_ptr) {
90
+ const DiagnosticEventData *diagnostic_data =
91
+ DiagnosticEventData::GetEventDataFromEvent (event_ptr);
92
+
93
+ if (!diagnostic_data)
94
+ return {};
95
+
96
+ auto dictionary_sp = std::make_shared<StructuredData::Dictionary>();
97
+ dictionary_sp->AddStringItem (" message" , diagnostic_data->GetMessage ());
98
+ dictionary_sp->AddStringItem (" type" , diagnostic_data->GetPrefix ());
99
+ dictionary_sp->AddBooleanItem (" debugger_specific" ,
100
+ diagnostic_data->IsDebuggerSpecific ());
101
+ return dictionary_sp;
102
+ }
103
+
88
104
ConstString SymbolChangeEventData::GetFlavorString () {
89
105
static ConstString g_flavor (" SymbolChangeEventData" );
90
106
return g_flavor;
You can’t perform that action at this time.
0 commit comments