-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Nits on uses of llvm::raw_string_ostream (NFC) #108745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* 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.
@llvm/pr-subscribers-lldb Author: Youngsuk Kim (JOE1994) Changes
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:
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]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this is safe because after 65b1361, raw_string_ostream
is always unbuffered so you (1) don't need to flush and (2) can use the underlying buffer directly. That makes sense. Please include that in your commit message.
I would have split this up into two PRs/commits as the changes are related but can stand on their own, but it's not important enough to make you do more work. LGTM.
…gressEvent.cpp; addressing llvm#108745
…gressEvent.cpp; addressing #108745 (#114087) I hope it was missed unintentionally, pushing the same for the review. Ref: #108745 --------- Co-authored-by: Santhosh Kumar Ellendula <[email protected]> Co-authored-by: Santhosh Kumar Ellendula <[email protected]>
…gressEvent.cpp; addressing llvm#108745 (llvm#114087) I hope it was missed unintentionally, pushing the same for the review. Ref: llvm#108745 --------- Co-authored-by: Santhosh Kumar Ellendula <[email protected]> Co-authored-by: Santhosh Kumar Ellendula <[email protected]>
…gressEvent.cpp; addressing llvm#108745 (llvm#114087) I hope it was missed unintentionally, pushing the same for the review. Ref: llvm#108745 --------- Co-authored-by: Santhosh Kumar Ellendula <[email protected]> Co-authored-by: Santhosh Kumar Ellendula <[email protected]> (cherry picked from commit 62ff85f)
As specified in the docs,
( 65b1361 for further reference )