Skip to content

Commit f35719f

Browse files
authored
[lldb] Don't flush llvm::raw_string_ostream (NFC) (llvm#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. ( 65b1361 for further reference )
1 parent 24d707e commit f35719f

File tree

9 files changed

+0
-19
lines changed

9 files changed

+0
-19
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
129129

130130
function_decl->print(os);
131131

132-
os.flush();
133-
134132
LLDB_LOGF(log, "Untransformed function AST:\n%s", s.c_str());
135133
}
136134

@@ -145,8 +143,6 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) {
145143

146144
function_decl->print(os);
147145

148-
os.flush();
149-
150146
LLDB_LOGF(log, "Transformed function AST:\n%s", s.c_str());
151147
}
152148

@@ -169,8 +165,6 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult(
169165

170166
MethodDecl->print(os);
171167

172-
os.flush();
173-
174168
LLDB_LOGF(log, "Untransformed method AST:\n%s", s.c_str());
175169
}
176170

@@ -189,8 +183,6 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult(
189183

190184
MethodDecl->print(os);
191185

192-
os.flush();
193-
194186
LLDB_LOGF(log, "Transformed method AST:\n%s", s.c_str());
195187
}
196188

@@ -476,7 +468,6 @@ void ASTResultSynthesizer::CommitPersistentDecls() {
476468
std::string s;
477469
llvm::raw_string_ostream ss(s);
478470
decl->dump(ss);
479-
ss.flush();
480471

481472
LLDB_LOGF(log, "Couldn't commit persistent decl: %s\n", s.c_str());
482473
}

lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,6 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(
11621162
if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from)) {
11631163
llvm::raw_string_ostream name_stream(name_string);
11641164
from_named_decl->printName(name_stream);
1165-
name_stream.flush();
11661165
}
11671166
LLDB_LOG(log_ast,
11681167
"==== [ClangASTImporter][TUDecl: {0:x}] Imported "
@@ -1292,7 +1291,6 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
12921291
std::string name_string;
12931292
llvm::raw_string_ostream name_stream(name_string);
12941293
from_named_decl->printName(name_stream);
1295-
name_stream.flush();
12961294

12971295
LLDB_LOG(
12981296
log,

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
210210
// Render diagnostic message to m_output.
211211
m_output.clear();
212212
m_passthrough->HandleDiagnostic(DiagLevel, Info);
213-
m_os->flush();
214213

215214
lldb::Severity severity;
216215
bool make_new_diagnostic = true;

lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ std::string ClangUtil::DumpDecl(const clang::Decl *d) {
7474
bool deserialize = false;
7575
d->dump(stream, deserialize);
7676

77-
stream.flush();
7877
return result;
7978
}
8079

lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ DebuggerThread::HandleCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO &info,
374374
std::string thread_name;
375375
llvm::raw_string_ostream name_stream(thread_name);
376376
name_stream << "lldb.plugin.process-windows.secondary[" << process_id << "]";
377-
name_stream.flush();
378377
llvm::set_thread_name(thread_name);
379378

380379
// info.hProcess and info.hThread are closed automatically by Windows when

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3702,7 +3702,6 @@ GDBRemoteCommunicationClient::SendTraceStart(const llvm::json::Value &params,
37023702
std::string json_string;
37033703
llvm::raw_string_ostream os(json_string);
37043704
os << params;
3705-
os.flush();
37063705

37073706
escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size());
37083707

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ GDBRemoteCommunicationServer::SendJSONResponse(const json::Value &value) {
155155
std::string json_string;
156156
raw_string_ostream os(json_string);
157157
os << value;
158-
os.flush();
159158
StreamGDBRemote escaped_response;
160159
escaped_response.PutEscapedBytes(json_string.c_str(), json_string.size());
161160
return SendPacketNoLock(escaped_response.GetString());

lldb/source/Utility/UUID.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ std::string UUID::GetAsString(llvm::StringRef separator) const {
5656

5757
os << llvm::format_hex_no_prefix(B.value(), 2, true);
5858
}
59-
os.flush();
6059

6160
return result;
6261
}

lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class MinidumpParserTest : public testing::Test {
5959
return llvm::createStringError(llvm::inconvertibleErrorCode(),
6060
"convertYAML() failed");
6161

62-
os.flush();
6362
auto data_buffer_sp =
6463
std::make_shared<DataBufferHeap>(data.data(), data.size());
6564
auto expected_parser = MinidumpParser::Create(std::move(data_buffer_sp));
@@ -85,7 +84,6 @@ TEST_F(MinidumpParserTest, InvalidMinidump) {
8584
)");
8685

8786
ASSERT_TRUE(llvm::yaml::convertYAML(YIn, os, [](const llvm::Twine &Msg){}));
88-
os.flush();
8987
auto data_buffer_sp = std::make_shared<DataBufferHeap>(
9088
duplicate_streams.data(), duplicate_streams.size());
9189
ASSERT_THAT_EXPECTED(MinidumpParser::Create(data_buffer_sp), llvm::Failed());

0 commit comments

Comments
 (0)