From d7796855b87911b8ae6c726ab5df4949f173dbd2 Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Mon, 16 Sep 2024 00:26:51 -0400 Subject: [lldb] Nits on uses of llvm::raw_string_ostream (NFC) (#108745) As specified in the docs, 1) raw_string_ostream is always unbuffered and 2) the underlying buffer may be used directly ( 65b13610a5226b84889b923bae884ba395ad084d for further reference ) * Don't call raw_string_ostream::flush(), which is essentially a no-op. * Avoid unneeded calls to raw_string_ostream::str(), to avoid excess indirection. --- lldb/source/Commands/CommandObjectLog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lldb/source/Commands/CommandObjectLog.cpp') diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 9eb68dd..5fb2dfa 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -204,7 +204,7 @@ protected: channel, args.GetArgumentArrayRef(), log_file, m_options.log_options, m_options.buffer_size.GetCurrentValue(), m_options.handler, error_stream); - result.GetErrorStream() << error_stream.str(); + result.GetErrorStream() << error; if (success) result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -273,7 +273,7 @@ protected: if (Log::DisableLogChannel(channel, args.GetArgumentArrayRef(), error_stream)) result.SetStatus(eReturnStatusSuccessFinishNoResult); - result.GetErrorStream() << error_stream.str(); + result.GetErrorStream() << error; } } }; @@ -313,7 +313,7 @@ protected: if (success) result.SetStatus(eReturnStatusSuccessFinishResult); } - result.GetOutputStream() << output_stream.str(); + result.GetOutputStream() << output; } }; class CommandObjectLogDump : public CommandObjectParsed { @@ -404,7 +404,7 @@ protected: result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.SetStatus(eReturnStatusFailed); - result.GetErrorStream() << error_stream.str(); + result.GetErrorStream() << error; } } -- cgit v1.1