llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Youngsuk Kim (JOE1994) <details> <summary>Changes</summary> * 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. --- Patch is 26.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/108745.diff 37 Files Affected: - (modified) lldb/include/lldb/Utility/Instrumentation.h (+1-1) - (modified) lldb/source/Breakpoint/Breakpoint.cpp (+1-1) - (modified) lldb/source/Commands/CommandObjectLog.cpp (+4-4) - (modified) lldb/source/Commands/CommandObjectRegexCommand.cpp (+1-1) - (modified) lldb/source/Core/Module.cpp (+2-2) - (modified) lldb/source/Expression/IRExecutionUnit.cpp (-2) - (modified) lldb/source/Expression/IRInterpreter.cpp (-4) - (modified) lldb/source/Host/windows/PipeWindows.cpp (-1) - (modified) lldb/source/Interpreter/Options.cpp (+1-1) - (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp (-2) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (-2) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (-1) - (modified) lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp (-3) - (modified) lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (-9) - (modified) lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (+1-1) - (modified) lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp (+1-1) - (modified) lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (+3-3) - (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (+1-4) - (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+1-1) - (modified) lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp (+2-2) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (+1-1) - (modified) lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp (+1-1) - (modified) lldb/source/Symbol/Symtab.cpp (+1-1) - (modified) lldb/source/Target/Statistics.cpp (+1-1) - (modified) lldb/source/Target/Target.cpp (+1-1) - (modified) lldb/source/Utility/LLDBAssert.cpp (+1-1) - (modified) lldb/source/Utility/Log.cpp (+1-1) - (modified) lldb/tools/lldb-dap/DAP.cpp (+2-4) - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (-1) - (modified) lldb/tools/lldb-dap/LLDBUtils.cpp (-1) - (modified) lldb/tools/lldb-dap/lldb-dap.cpp (-3) - (modified) lldb/tools/lldb-instr/Instrument.cpp (+2-2) - (modified) lldb/tools/lldb-server/LLDBServerUtilities.cpp (+1-1) - (modified) lldb/tools/lldb-test/lldb-test.cpp (+1-1) - (modified) lldb/unittests/Symbol/PostfixExpressionTest.cpp (+1-1) - (modified) lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp (+1-1) ``````````diff diff --git a/lldb/include/lldb/Utility/Instrumentation.h b/lldb/include/lldb/Utility/Instrumentation.h index 4a9ac810eb05e9..1a86bfb38654b5 100644 --- a/lldb/include/lldb/Utility/Instrumentation.h +++ b/lldb/include/lldb/Utility/Instrumentation.h @@ -70,7 +70,7 @@ template <typename... Ts> inline std::string stringify_args(const Ts &...ts) { std::string buffer; llvm::raw_string_ostream ss(buffer); stringify_helper(ss, ts...); - return ss.str(); + return buffer; } /// RAII object for instrumenting LLDB API functions. diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 3268ce0b6857da..54ebafc3f65b5c 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -1127,7 +1127,7 @@ json::Value Breakpoint::GetStatistics() { llvm::raw_string_ostream ss(buffer); json::OStream json_os(ss); bp_data_sp->Serialize(json_os); - if (auto expected_value = llvm::json::parse(ss.str())) { + if (auto expected_value = llvm::json::parse(buffer)) { bp.try_emplace("details", std::move(*expected_value)); } else { std::string details_error = toString(expected_value.takeError()); diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 9eb68ddb73b6e9..5fb2dfaab8de03 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -204,7 +204,7 @@ class CommandObjectLogEnable : public CommandObjectParsed { 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 @@ class CommandObjectLogDisable : public CommandObjectParsed { if (Log::DisableLogChannel(channel, args.GetArgumentArrayRef(), error_stream)) result.SetStatus(eReturnStatusSuccessFinishNoResult); - result.GetErrorStream() << error_stream.str(); + result.GetErrorStream() << error; } } }; @@ -313,7 +313,7 @@ class CommandObjectLogList : public CommandObjectParsed { if (success) result.SetStatus(eReturnStatusSuccessFinishResult); } - result.GetOutputStream() << output_stream.str(); + result.GetOutputStream() << output; } }; class CommandObjectLogDump : public CommandObjectParsed { @@ -404,7 +404,7 @@ class CommandObjectLogDump : public CommandObjectParsed { result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.SetStatus(eReturnStatusFailed); - result.GetErrorStream() << error_stream.str(); + result.GetErrorStream() << error; } } diff --git a/lldb/source/Commands/CommandObjectRegexCommand.cpp b/lldb/source/Commands/CommandObjectRegexCommand.cpp index f638d707e17e78..7e27915aaaa469 100644 --- a/lldb/source/Commands/CommandObjectRegexCommand.cpp +++ b/lldb/source/Commands/CommandObjectRegexCommand.cpp @@ -51,7 +51,7 @@ llvm::Expected<std::string> CommandObjectRegexCommand::SubstituteVariables( output << part; } - return output.str(); + return buffer; } void CommandObjectRegexCommand::DoExecute(llvm::StringRef command, diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 8595a22175d98d..88cc957e91fac4 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1626,7 +1626,7 @@ uint32_t Module::Hash() { const auto mtime = llvm::sys::toTimeT(m_object_mod_time); if (mtime > 0) id_strm << mtime; - return llvm::djbHash(id_strm.str()); + return llvm::djbHash(identifier); } std::string Module::GetCacheKey() { @@ -1636,7 +1636,7 @@ std::string Module::GetCacheKey() { if (m_object_name) strm << '(' << m_object_name << ')'; strm << '-' << llvm::format_hex(Hash(), 10); - return strm.str(); + return key; } DataFileCache *Module::GetIndexCache() { diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index d2f2ee26fd4307..15ca2ddbbae046 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -261,8 +261,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, m_module->print(oss, nullptr); - oss.flush(); - LLDB_LOGF(log, "Module being sent to JIT: \n%s", s.c_str()); } diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 593258f4407d58..4909310db7a6df 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -49,7 +49,6 @@ static std::string PrintValue(const Value *value, bool truncate = false) { std::string s; raw_string_ostream rso(s); value->print(rso); - rso.flush(); if (truncate) s.resize(s.length() - 1); @@ -66,7 +65,6 @@ static std::string PrintType(const Type *type, bool truncate = false) { std::string s; raw_string_ostream rso(s); type->print(rso); - rso.flush(); if (truncate) s.resize(s.length() - 1); return s; @@ -698,8 +696,6 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, module.print(oss, nullptr); - oss.flush(); - LLDB_LOGF(log, "Module as passed in to IRInterpreter::Interpret: \n\"%s\"", s.c_str()); } diff --git a/lldb/source/Host/windows/PipeWindows.cpp b/lldb/source/Host/windows/PipeWindows.cpp index d79dc3c2f82c90..21e30f0ae87384 100644 --- a/lldb/source/Host/windows/PipeWindows.cpp +++ b/lldb/source/Host/windows/PipeWindows.cpp @@ -74,7 +74,6 @@ Status PipeWindows::CreateNew(bool child_process_inherit) { std::string pipe_name; llvm::raw_string_ostream pipe_name_stream(pipe_name); pipe_name_stream << "lldb.pipe." << ::GetCurrentProcessId() << "." << serial; - pipe_name_stream.flush(); return CreateNew(pipe_name.c_str(), child_process_inherit); } diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index 27eda289109ebe..b8a3f68a49b1cf 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -923,7 +923,7 @@ static std::string BuildShortOptions(const Option *long_options) { } } } - return std::move(sstr.str()); + return storage; } llvm::Expected<Args> Options::ParseAlias(const Args &args, diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index 1628107170e7b1..31edd8d46c444e 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1366,8 +1366,6 @@ void DisassemblerLLVMC::MCDisasmInstance::PrintMCInst( *m_subtarget_info_up, inst_stream); m_instr_printer_up->setCommentStream(llvm::nulls()); - comments_stream.flush(); - static std::string g_newlines("\r\n"); for (size_t newline_pos = 0; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 90f26de939a478..2fe3c0460aa7f8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -984,7 +984,6 @@ class CodeComplete : public CodeCompleteConsumer { ToInsert += "("; raw_string_ostream OS(Description); F->print(OS, m_desc_policy, false); - OS.flush(); } else if (const VarDecl *V = dyn_cast<VarDecl>(D)) { Description = V->getType().getAsString(m_desc_policy); } else if (const FieldDecl *F = dyn_cast<FieldDecl>(D)) { @@ -1358,7 +1357,6 @@ bool ClangExpressionParser::RewriteExpression( llvm::raw_string_ostream out_stream(fixed_expression); main_file_buffer.write(out_stream); - out_stream.flush(); diagnostic_manager.SetFixedExpression(fixed_expression); return true; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 024fc75a5dd590..a43701cba35374 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -147,7 +147,6 @@ void StoringDiagnosticConsumer::HandleDiagnostic( // Print the diagnostic to m_output. m_output.clear(); m_diag_printer->HandleDiagnostic(DiagLevel, info); - m_os->flush(); // Store the diagnostic for later. m_diagnostics.push_back(IDAndDiagnostic(DiagLevel, m_output)); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp index defd72bbd93106..45bdc7272936ca 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -94,7 +94,6 @@ static std::string PrintValue(llvm::Value *V, bool truncate = false) { std::string s; raw_string_ostream rso(s); V->print(rso); - rso.flush(); if (truncate) s.resize(s.length() - 1); return s; @@ -553,8 +552,6 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) { M.print(oss, nullptr); - oss.flush(); - LLDB_LOGF(log, "Module after dynamic checks: \n%s", s.c_str()); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 34461da46dfc7b..3764668fb27e82 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -86,7 +86,6 @@ static std::string PrintValue(const Value *value, bool truncate = false) { if (value) { raw_string_ostream rso(s); value->print(rso); - rso.flush(); if (truncate) s.resize(s.length() - 1); } @@ -97,7 +96,6 @@ static std::string PrintType(const llvm::Type *type, bool truncate = false) { std::string s; raw_string_ostream rso(s); type->print(rso); - rso.flush(); if (truncate) s.resize(s.length() - 1); return s; @@ -244,7 +242,6 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { std::string decl_desc_str; raw_string_ostream decl_desc_stream(decl_desc_str); result_decl->print(decl_desc_stream); - decl_desc_stream.flush(); LLDB_LOG(log, "Found result decl: \"{0}\"", decl_desc_str); } @@ -1616,8 +1613,6 @@ bool IRForTarget::runOnModule(Module &llvm_module) { m_module->print(oss, nullptr); - oss.flush(); - LLDB_LOG(log, "Module as passed in to IRForTarget: \n\"{0}\"", s); } @@ -1663,8 +1658,6 @@ bool IRForTarget::runOnModule(Module &llvm_module) { m_module->print(oss, nullptr); - oss.flush(); - LLDB_LOG(log, "Module after creating the result variable: \n\"{0}\"", s); } @@ -1762,8 +1755,6 @@ bool IRForTarget::runOnModule(Module &llvm_module) { m_module->print(oss, nullptr); - oss.flush(); - LLDB_LOG(log, "Module after preparing for execution: \n\"{0}\"", s); } diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index 0f153878423be7..41492ca836fac8 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -2685,7 +2685,7 @@ void AppleObjCRuntimeV2::WarnIfNoExpandedSharedCache() { } os << ". This will likely reduce debugging performance.\n"; - Debugger::ReportWarning(os.str(), debugger.GetID(), + Debugger::ReportWarning(buffer, debugger.GetID(), &m_no_expanded_cache_warning); } diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index 24c9aa6b32659d..9c330ff1186709 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -548,7 +548,7 @@ NativeProcessWindows::OnDebugException(bool first_chance, << " encountered at address " << llvm::format_hex(record.GetExceptionAddress(), 8); StopThread(record.GetThreadID(), StopReason::eStopReasonException, - desc_stream.str().c_str()); + desc.c_str()); SetState(eStateStopped, true); } diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index b25068dda53ffe..703aa082f0476f 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -492,10 +492,10 @@ void ProcessWindows::RefreshStateAfterStop() { << llvm::format_hex(active_exception->GetExceptionAddress(), 8); DumpAdditionalExceptionInformation(desc_stream, active_exception); - stop_info = StopInfo::CreateStopReasonWithException( - *stop_thread, desc_stream.str().c_str()); + stop_info = + StopInfo::CreateStopReasonWithException(*stop_thread, desc.c_str()); stop_thread->SetStopInfo(stop_info); - LLDB_LOG(log, "{0}", desc_stream.str()); + LLDB_LOG(log, "{0}", desc); return; } } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 23baa922227c1d..d005cf1e3d3c26 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -3668,7 +3668,6 @@ GDBRemoteCommunicationClient::SendTraceStop(const TraceStopRequest &request, std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(request); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -3738,7 +3737,6 @@ GDBRemoteCommunicationClient::SendTraceGetState(llvm::StringRef type, std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(TraceGetStateRequest{type.str()}); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -3772,7 +3770,6 @@ GDBRemoteCommunicationClient::SendTraceGetBinaryData( std::string json_string; llvm::raw_string_ostream os(json_string); os << toJSON(request); - os.flush(); escaped_packet.PutEscapedBytes(json_string.c_str(), json_string.size()); @@ -4045,7 +4042,7 @@ GDBRemoteCommunicationClient::ReadExtFeature(llvm::StringRef object, } } - return output_stream.str(); + return output; } // Notify the target that gdb is prepared to serve symbol lookup requests. diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 271ff61a7188a6..d5dfe79fd8862a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -5360,7 +5360,7 @@ std::string ProcessGDBRemote::HarmonizeThreadIdsForProfileData( output_stream << end_delimiter; m_thread_id_to_used_usec_map = new_thread_id_to_used_usec_map; - return output_stream.str(); + return output; } void ProcessGDBRemote::HandleStopReply() { diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 42cc9f02518b32..32ffba763c08e3 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -289,8 +289,8 @@ void ProcessMinidump::RefreshStateAfterStop() { << " encountered at address " << llvm::format_hex( exception_stream.ExceptionRecord.ExceptionAddress, 8); - stop_info = StopInfo::CreateStopReasonWithException( - *stop_thread, desc_stream.str().c_str()); + stop_info = + StopInfo::CreateStopReasonWithException(*stop_thread, desc.c_str()); } stop_thread->SetStopInfo(stop_info); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp index 32d8a92305aafa..373b3d9ed2eaa9 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp @@ -501,5 +501,5 @@ void DebugNamesDWARFIndex::Dump(Stream &s) { std::string data; llvm::raw_string_ostream os(data); m_debug_names_up->dump(os); - s.PutCString(os.str()); + s.PutCString(data); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index d581d3773ab23e..887983de2e8516 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -697,7 +697,7 @@ std::string ManualDWARFIndex::GetCacheKey() { ObjectFile *objfile = m_dwarf->GetObjectFile(); strm << objfile->GetModule()->GetCacheKey() << "-dwarf-index-" << llvm::format_hex(objfile->GetCacheHash(), 10); - return strm.str(); + return key; } bool ManualDWARFIndex::LoadFromCache() { diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp index 1a9f6fe3050908..c00eebc823a8c7 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp @@ -72,7 +72,7 @@ Error TraceIntelPTBundleLoader::CreateJSONError(json::Path::Root &root, root.printErrorContext(value, os); return createStringError( std::errc::invalid_argument, "%s\n\nContext:\n%s\n\nSchema:\n%s", - toString(root.getError()).c_str(), os.str().c_str(), GetSchema().data()); + toString(root.getError()).c_str(), err.c_str(), GetSchema().data()); } ThreadPostMortemTraceSP diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 5b5bf5c3f6f8c7..3c5075d9bb18ba 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -1179,7 +1179,7 @@ std::string Symtab::GetCacheKey() { // another object file in a separate symbol file. strm << m_objfile->GetModule()->GetCacheKey() << "-symtab-" << llvm::format_hex(m_objfile->GetCacheHash(), 10); - return strm.str(); + return key; } void Symtab::SaveToCache() { diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp index d619f92122cb9d..ae2f65ea4c4bdc 100644 --- a/lldb/source/Target/Statistics.cpp +++ b/lldb/source/Target/Statistics.cpp @@ -414,7 +414,7 @@ llvm::json::Value DebuggerStats::ReportStatistics( llvm::raw_string_ostream ss(buffer); json::OStream json_os(ss); transcript.Serialize(json_os); - if (auto json_transcript = llvm::json::parse(ss.str())) + if (auto json_transcript = llvm::json::parse(buffer)) global_stats.try_emplace("transcript", std::move(json_transcript.get())); } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 3e7e7b7d784e90..f1659aae0800db 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4603,7 +4603,7 @@ void TargetProperties::CheckJITObjectsDir() { std::optional<lldb::user_id_t> debugger_id; if (m_target) debugger_id = m_target->GetDebugger().GetID(); - Debugger::ReportError(os.str(), debugger_id); + Debugger::ReportError(buffer, debugger_id); } bool TargetProperties::GetEnableSyntheticValue() const { diff --git a/lldb/source/Utility/LLDBAssert.cpp b/lldb/source/Utility/LLDBAssert.cpp index 4ecd6043e8ea6f..b0c39a284910b1 100644 --- a/lldb/source/Utility/LLDBAssert.cpp +++ b/lldb/source/Utility/LLDBAssert.cpp @@ -54,7 +54,7 @@ void lldb_assert(bool expression, const char *expr_text, const char *func, llvm... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/108745 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits