[Lldb-commits] [lldb] r374239 - remove a smattering of isolated, unnecessary uses of FILE*

Lawrence D'Anna via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 14:50:52 PDT 2019


Author: lawrence_danna
Date: Wed Oct  9 14:50:52 2019
New Revision: 374239

URL: http://llvm.org/viewvc/llvm-project?rev=374239&view=rev
Log:
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

Modified:
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Expression/REPL.cpp

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=374239&r1=374238&r2=374239&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Oct  9 14:50:52 2019
@@ -467,10 +467,8 @@ void SBDebugger::HandleCommand(const cha
 
     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());

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=374239&r1=374238&r2=374239&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Wed Oct  9 14:50:52 2019
@@ -329,10 +329,9 @@ bool IOHandlerEditline::GetLine(std::str
           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(StringL
       // 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();

Modified: lldb/trunk/source/Expression/REPL.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/REPL.cpp?rev=374239&r1=374238&r2=374239&view=diff
==============================================================================
--- lldb/trunk/source/Expression/REPL.cpp (original)
+++ lldb/trunk/source/Expression/REPL.cpp Wed Oct  9 14:50:52 2019
@@ -423,7 +423,7 @@ void REPL::IOHandlerInputComplete(IOHand
               .SetBaseLineNumber(m_code.GetSize() + 1);
         }
         if (extra_line) {
-          fprintf(output_sp->GetFile().GetStream(), "\n");
+          output_sp->Printf("\n");
         }
       }
     }




More information about the lldb-commits mailing list