From: Lawrence D'Anna Date: Wed, 9 Oct 2019 21:50:52 +0000 (+0000) Subject: remove a smattering of isolated, unnecessary uses of FILE* X-Git-Tag: llvmorg-11-init~7040 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5da2bc22badde8748a71b1e8ad1ef0bd8e2ce386;p=platform%2Fupstream%2Fllvm.git remove a smattering of isolated, unnecessary uses of FILE* Summary: There a a few call sites that use FILE* which are easy to fix without disrupting anything else. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere, labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68444 llvm-svn: 374239 --- diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 4bc25c40046a..4d27b43e675b 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -467,10 +467,8 @@ void SBDebugger::HandleCommand(const char *command) { sb_interpreter.HandleCommand(command, result, false); - if (GetErrorFileHandle() != nullptr) - result.PutError(GetErrorFile()); - if (GetOutputFileHandle() != nullptr) - result.PutOutput(GetOutputFile()); + result.PutError(m_opaque_sp->GetErrorStream().GetFileSP()); + result.PutOutput(m_opaque_sp->GetOutputStream().GetFileSP()); if (!m_opaque_sp->GetAsyncExecution()) { SBProcess process(GetCommandInterpreter().GetProcess()); diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index 350a53835077..d3152981a567 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -329,10 +329,9 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) { prompt = GetPrompt(); if (prompt && prompt[0]) { - FILE *out = GetOutputFILE(); - if (out) { - ::fprintf(out, "%s", prompt); - ::fflush(out); + if (m_output_sp) { + m_output_sp->Printf("%s", prompt); + m_output_sp->Flush(); } } } @@ -491,10 +490,11 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) { // Show line numbers if we are asked to std::string line; if (m_base_line_number > 0 && GetIsInteractive()) { - FILE *out = GetOutputFILE(); - if (out) - ::fprintf(out, "%u%s", m_base_line_number + (uint32_t)lines.GetSize(), - GetPrompt() == nullptr ? " " : ""); + if (m_output_sp) { + m_output_sp->Printf("%u%s", + m_base_line_number + (uint32_t)lines.GetSize(), + GetPrompt() == nullptr ? " " : ""); + } } m_curr_line_idx = lines.GetSize(); diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index 78e468810234..4f81ee3e56dd 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -423,7 +423,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { .SetBaseLineNumber(m_code.GetSize() + 1); } if (extra_line) { - fprintf(output_sp->GetFile().GetStream(), "\n"); + output_sp->Printf("\n"); } } }