Author: Youngsuk Kim Date: 2024-09-26T12:29:14-04:00 New Revision: f35719ff670521454c8dfd83ec9d55dde65a5c3d
URL: https://github.com/llvm/llvm-project/commit/f35719ff670521454c8dfd83ec9d55dde65a5c3d DIFF: https://github.com/llvm/llvm-project/commit/f35719ff670521454c8dfd83ec9d55dde65a5c3d.diff LOG: [lldb] Don't flush llvm::raw_string_ostream (NFC) (#110128) Don't call raw_string_ostream::flush(), which is essentially a no-op. As specified in the docs, raw_string_ostream is always unbuffered. ( 65b13610a5226b84889b923bae884ba395ad084d for further reference ) Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp lldb/source/Utility/UUID.cpp lldb/unittests/Process/minidump/MinidumpParserTest.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 3e2c208bd2018e..fd965d0127a2df 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -129,8 +129,6 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) { function_decl->print(os); - os.flush(); - LLDB_LOGF(log, "Untransformed function AST:\n%s", s.c_str()); } @@ -145,8 +143,6 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) { function_decl->print(os); - os.flush(); - LLDB_LOGF(log, "Transformed function AST:\n%s", s.c_str()); } @@ -169,8 +165,6 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult( MethodDecl->print(os); - os.flush(); - LLDB_LOGF(log, "Untransformed method AST:\n%s", s.c_str()); } @@ -189,8 +183,6 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult( MethodDecl->print(os); - os.flush(); - LLDB_LOGF(log, "Transformed method AST:\n%s", s.c_str()); } @@ -476,7 +468,6 @@ void ASTResultSynthesizer::CommitPersistentDecls() { std::string s; llvm::raw_string_ostream ss(s); decl->dump(ss); - ss.flush(); LLDB_LOGF(log, "Couldn't commit persistent decl: %s\n", s.c_str()); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp index adf13ff736adc2..630ad7e20ab7e0 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp @@ -1162,7 +1162,6 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo( if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from)) { llvm::raw_string_ostream name_stream(name_string); from_named_decl->printName(name_stream); - name_stream.flush(); } LLDB_LOG(log_ast, "==== [ClangASTImporter][TUDecl: {0:x}] Imported " @@ -1292,7 +1291,6 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, std::string name_string; llvm::raw_string_ostream name_stream(name_string); from_named_decl->printName(name_stream); - name_stream.flush(); LLDB_LOG( log, diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 2fe3c0460aa7f8..4eeac372a2e657 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -210,7 +210,6 @@ class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer { // Render diagnostic message to m_output. m_output.clear(); m_passthrough->HandleDiagnostic(DiagLevel, Info); - m_os->flush(); lldb::Severity severity; bool make_new_diagnostic = true; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp index 2e0bb318cb5076..4cda426e727049 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp @@ -74,7 +74,6 @@ std::string ClangUtil::DumpDecl(const clang::Decl *d) { bool deserialize = false; d->dump(stream, deserialize); - stream.flush(); return result; } diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp index d62eb26ca1a293..ca8e9c078e1f99 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -374,7 +374,6 @@ DebuggerThread::HandleCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO &info, std::string thread_name; llvm::raw_string_ostream name_stream(thread_name); name_stream << "lldb.plugin.process-windows.secondary[" << process_id << "]"; - name_stream.flush(); llvm::set_thread_name(thread_name); // info.hProcess and info.hThread are closed automatically by Windows when diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index d005cf1e3d3c26..e42526c8fd7266 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -3702,7 +3702,6 @@ GDBRemoteCommunicationClient::SendTraceStart(const llvm::json::Value ¶ms, std::string json_string; llvm::raw_string_ostream os(json_string); os << params; - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index d4aa90b2c7731a..5bd29ae40aa9eb 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -155,7 +155,6 @@ GDBRemoteCommunicationServer::SendJSONResponse(const json::Value &value) { std::string json_string; raw_string_ostream os(json_string); os << value; - os.flush(); StreamGDBRemote escaped_response; escaped_response.PutEscapedBytes(json_string.c_str(), json_string.size()); return SendPacketNoLock(escaped_response.GetString()); diff --git a/lldb/source/Utility/UUID.cpp b/lldb/source/Utility/UUID.cpp index 57e3a39d1f8e9b..370b8b6848c7e4 100644 --- a/lldb/source/Utility/UUID.cpp +++ b/lldb/source/Utility/UUID.cpp @@ -56,7 +56,6 @@ std::string UUID::GetAsString(llvm::StringRef separator) const { os << llvm::format_hex_no_prefix(B.value(), 2, true); } - os.flush(); return result; } diff --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp index c7547ba261c7f7..a6d015e79a7ef2 100644 --- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp +++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp @@ -59,7 +59,6 @@ class MinidumpParserTest : public testing::Test { return llvm::createStringError(llvm::inconvertibleErrorCode(), "convertYAML() failed"); - os.flush(); auto data_buffer_sp = std::make_shared<DataBufferHeap>(data.data(), data.size()); auto expected_parser = MinidumpParser::Create(std::move(data_buffer_sp)); @@ -85,7 +84,6 @@ TEST_F(MinidumpParserTest, InvalidMinidump) { )"); ASSERT_TRUE(llvm::yaml::convertYAML(YIn, os, [](const llvm::Twine &Msg){})); - os.flush(); auto data_buffer_sp = std::make_shared<DataBufferHeap>( duplicate_streams.data(), duplicate_streams.size()); ASSERT_THAT_EXPECTED(MinidumpParser::Create(data_buffer_sp), llvm::Failed()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits