@@ -257,7 +257,7 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
257257 std::list<Status> errors;
258258 StreamString feedback_stream;
259259 if (!target_sp->LoadScriptingResources (errors, feedback_stream)) {
260- lldb::StreamSP s = GetAsyncErrorStream ();
260+ lldb::StreamUP s = GetAsyncErrorStream ();
261261 for (auto &error : errors)
262262 s->Printf (" %s\n " , error.AsCString ());
263263 if (feedback_stream.GetSize ())
@@ -1367,13 +1367,13 @@ bool Debugger::PopIOHandler(const IOHandlerSP &pop_reader_sp) {
13671367 return true ;
13681368}
13691369
1370- StreamSP Debugger::GetAsyncOutputStream () {
1371- return std::make_shared <StreamAsynchronousIO>(*this ,
1370+ StreamUP Debugger::GetAsyncOutputStream () {
1371+ return std::make_unique <StreamAsynchronousIO>(*this ,
13721372 StreamAsynchronousIO::STDOUT);
13731373}
13741374
1375- StreamSP Debugger::GetAsyncErrorStream () {
1376- return std::make_shared <StreamAsynchronousIO>(*this ,
1375+ StreamUP Debugger::GetAsyncErrorStream () {
1376+ return std::make_unique <StreamAsynchronousIO>(*this ,
13771377 StreamAsynchronousIO::STDERR);
13781378}
13791379
@@ -1616,8 +1616,7 @@ static void PrivateReportDiagnostic(Debugger &debugger, Severity severity,
16161616 // diagnostic directly to the debugger's error stream.
16171617 DiagnosticEventData event_data (severity, std::move (message),
16181618 debugger_specific);
1619- StreamSP stream = debugger.GetAsyncErrorStream ();
1620- event_data.Dump (stream.get ());
1619+ event_data.Dump (debugger.GetAsyncErrorStream ().get ());
16211620 return ;
16221621 }
16231622 EventSP event_sp = std::make_shared<Event>(
@@ -1813,12 +1812,11 @@ void Debugger::HandleBreakpointEvent(const EventSP &event_sp) {
18131812 if (num_new_locations > 0 ) {
18141813 BreakpointSP breakpoint =
18151814 Breakpoint::BreakpointEventData::GetBreakpointFromEvent (event_sp);
1816- StreamSP output_sp (GetAsyncOutputStream ());
1817- if (output_sp) {
1818- output_sp->Printf (" %d location%s added to breakpoint %d\n " ,
1815+ if (StreamUP output_up = GetAsyncOutputStream ()) {
1816+ output_up->Printf (" %d location%s added to breakpoint %d\n " ,
18191817 num_new_locations, num_new_locations == 1 ? " " : " s" ,
18201818 breakpoint->GetID ());
1821- output_sp ->Flush ();
1819+ output_up ->Flush ();
18221820 }
18231821 }
18241822 }
@@ -1862,8 +1860,8 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) {
18621860 ? EventDataStructuredData::GetProcessFromEvent (event_sp.get ())
18631861 : Process::ProcessEventData::GetProcessFromEvent (event_sp.get ());
18641862
1865- StreamSP output_stream_sp = GetAsyncOutputStream ();
1866- StreamSP error_stream_sp = GetAsyncErrorStream ();
1863+ StreamUP output_stream_up = GetAsyncOutputStream ();
1864+ StreamUP error_stream_up = GetAsyncErrorStream ();
18671865 const bool gui_enabled = IsForwardingEvents ();
18681866
18691867 if (!gui_enabled) {
@@ -1891,7 +1889,7 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) {
18911889 if (got_state_changed && !state_is_stopped) {
18921890 // This is a public stop which we are going to announce to the user, so
18931891 // we should force the most relevant frame selection here.
1894- Process::HandleProcessStateChangedEvent (event_sp, output_stream_sp .get (),
1892+ Process::HandleProcessStateChangedEvent (event_sp, output_stream_up .get (),
18951893 SelectMostRelevantFrame,
18961894 pop_process_io_handler,
18971895 // BEGIN SWIFT
@@ -1911,31 +1909,29 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) {
19111909 if (plugin_sp) {
19121910 auto structured_data_sp =
19131911 EventDataStructuredData::GetObjectFromEvent (event_sp.get ());
1914- if (output_stream_sp) {
1915- StreamString content_stream;
1916- Status error =
1917- plugin_sp->GetDescription (structured_data_sp, content_stream);
1918- if (error.Success ()) {
1919- if (!content_stream.GetString ().empty ()) {
1920- // Add newline.
1921- content_stream.PutChar (' \n ' );
1922- content_stream.Flush ();
1923-
1924- // Print it.
1925- output_stream_sp->PutCString (content_stream.GetString ());
1926- }
1927- } else {
1928- error_stream_sp->Format (" Failed to print structured "
1929- " data with plugin {0}: {1}" ,
1930- plugin_sp->GetPluginName (), error);
1912+ StreamString content_stream;
1913+ Status error =
1914+ plugin_sp->GetDescription (structured_data_sp, content_stream);
1915+ if (error.Success ()) {
1916+ if (!content_stream.GetString ().empty ()) {
1917+ // Add newline.
1918+ content_stream.PutChar (' \n ' );
1919+ content_stream.Flush ();
1920+
1921+ // Print it.
1922+ output_stream_up->PutCString (content_stream.GetString ());
19311923 }
1924+ } else {
1925+ error_stream_up->Format (" Failed to print structured "
1926+ " data with plugin {0}: {1}" ,
1927+ plugin_sp->GetPluginName (), error);
19321928 }
19331929 }
19341930 }
19351931
19361932 // Now display any stopped state changes after any STDIO
19371933 if (got_state_changed && state_is_stopped) {
1938- Process::HandleProcessStateChangedEvent (event_sp, output_stream_sp .get (),
1934+ Process::HandleProcessStateChangedEvent (event_sp, output_stream_up .get (),
19391935 SelectMostRelevantFrame,
19401936 pop_process_io_handler,
19411937 // BEGIN SWIFT
@@ -1944,8 +1940,8 @@ void Debugger::HandleProcessEvent(const EventSP &event_sp) {
19441940 );
19451941 }
19461942
1947- output_stream_sp ->Flush ();
1948- error_stream_sp ->Flush ();
1943+ output_stream_up ->Flush ();
1944+ error_stream_up ->Flush ();
19491945
19501946 if (pop_process_io_handler)
19511947 // BEGIN SWIFT
@@ -2047,22 +2043,18 @@ lldb::thread_result_t Debugger::DefaultEventHandler() {
20472043 const char *data = static_cast <const char *>(
20482044 EventDataBytes::GetBytesFromEvent (event_sp.get ()));
20492045 if (data && data[0 ]) {
2050- StreamSP error_sp (GetAsyncErrorStream ());
2051- if (error_sp) {
2052- error_sp->PutCString (data);
2053- error_sp->Flush ();
2054- }
2046+ StreamUP error_up = GetAsyncErrorStream ();
2047+ error_up->PutCString (data);
2048+ error_up->Flush ();
20552049 }
20562050 } else if (event_type & CommandInterpreter::
20572051 eBroadcastBitAsynchronousOutputData) {
20582052 const char *data = static_cast <const char *>(
20592053 EventDataBytes::GetBytesFromEvent (event_sp.get ()));
20602054 if (data && data[0 ]) {
2061- StreamSP output_sp (GetAsyncOutputStream ());
2062- if (output_sp) {
2063- output_sp->PutCString (data);
2064- output_sp->Flush ();
2065- }
2055+ StreamUP output_up = GetAsyncOutputStream ();
2056+ output_up->PutCString (data);
2057+ output_up->Flush ();
20662058 }
20672059 }
20682060 } else if (broadcaster == &m_broadcaster) {
@@ -2177,7 +2169,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
21772169 if (!file_sp->GetIsInteractive () || !file_sp->GetIsTerminalWithColors ())
21782170 return ;
21792171
2180- StreamSP output = GetAsyncOutputStream ();
2172+ StreamUP output = GetAsyncOutputStream ();
21812173
21822174 // Print over previous line, if any.
21832175 output->Printf (" \r " );
@@ -2227,8 +2219,7 @@ void Debugger::HandleDiagnosticEvent(const lldb::EventSP &event_sp) {
22272219 if (!data)
22282220 return ;
22292221
2230- StreamSP stream = GetAsyncErrorStream ();
2231- data->Dump (stream.get ());
2222+ data->Dump (GetAsyncErrorStream ().get ());
22322223}
22332224
22342225bool Debugger::HasIOHandlerThread () const {
0 commit comments