diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2025-02-12 08:29:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-12 08:29:06 -0800 |
commit | eff3c343b08cfc46016708b3182ac062d45b3e21 (patch) | |
tree | 6002909d7b485bb65f261ebce0bf414df157cf92 /lldb/source/API/SBDebugger.cpp | |
parent | bee9664970d51df3f4e1d298d1bcb95bba364e17 (diff) | |
download | llvm-eff3c343b08cfc46016708b3182ac062d45b3e21.zip llvm-eff3c343b08cfc46016708b3182ac062d45b3e21.tar.gz llvm-eff3c343b08cfc46016708b3182ac062d45b3e21.tar.bz2 |
[lldb] Remove Debugger::Get{Output,Error}Stream (NFC) (#126821)
Remove Debugger::GetOutputStream and Debugger::GetErrorStream in
preparation for replacing both with a new variant that needs to be
locked and hence can't be handed out like we do right now.
The patch replaces most uses with GetAsyncOutputStream and
GetAsyncErrorStream respectively. There methods return new StreamSP
objects that automatically get flushed on destruction.
See #126630 for more details.
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index bdb8e53..bf19d2f 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -508,39 +508,31 @@ SBFile SBDebugger::GetInputFile() { FILE *SBDebugger::GetOutputFileHandle() { LLDB_INSTRUMENT_VA(this); - if (m_opaque_sp) { - StreamFile &stream_file = m_opaque_sp->GetOutputStream(); - return stream_file.GetFile().GetStream(); - } + if (m_opaque_sp) + return m_opaque_sp->GetOutputStreamSP()->GetFile().GetStream(); return nullptr; } SBFile SBDebugger::GetOutputFile() { LLDB_INSTRUMENT_VA(this); - if (m_opaque_sp) { - SBFile file(m_opaque_sp->GetOutputStream().GetFileSP()); - return file; - } + if (m_opaque_sp) + return SBFile(m_opaque_sp->GetOutputStreamSP()->GetFileSP()); return SBFile(); } FILE *SBDebugger::GetErrorFileHandle() { LLDB_INSTRUMENT_VA(this); - if (m_opaque_sp) { - StreamFile &stream_file = m_opaque_sp->GetErrorStream(); - return stream_file.GetFile().GetStream(); - } + if (m_opaque_sp) + return m_opaque_sp->GetErrorStreamSP()->GetFile().GetStream(); return nullptr; } SBFile SBDebugger::GetErrorFile() { LLDB_INSTRUMENT_VA(this); SBFile file; - if (m_opaque_sp) { - SBFile file(m_opaque_sp->GetErrorStream().GetFileSP()); - return file; - } + if (m_opaque_sp) + return SBFile(m_opaque_sp->GetErrorStreamSP()->GetFileSP()); return SBFile(); } @@ -581,8 +573,8 @@ void SBDebugger::HandleCommand(const char *command) { sb_interpreter.HandleCommand(command, result, false); - result.PutError(m_opaque_sp->GetErrorStream().GetFileSP()); - result.PutOutput(m_opaque_sp->GetOutputStream().GetFileSP()); + result.PutError(m_opaque_sp->GetErrorStreamSP()->GetFileSP()); + result.PutOutput(m_opaque_sp->GetOutputStreamSP()->GetFileSP()); if (!m_opaque_sp->GetAsyncExecution()) { SBProcess process(GetCommandInterpreter().GetProcess()); |