[Lldb-commits] [PATCH] D68444: remove a smattering of isolated, unnecessary uses of FILE*

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5da2bc22badd: remove a smattering of isolated, unnecessary uses of FILE* (authored by lawrence_danna).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68444/new/

https://reviews.llvm.org/D68444

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


Index: lldb/source/Expression/REPL.cpp
===================================================================
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -423,7 +423,7 @@
               .SetBaseLineNumber(m_code.GetSize() + 1);
         }
         if (extra_line) {
-          fprintf(output_sp->GetFile().GetStream(), "\n");
+          output_sp->Printf("\n");
         }
       }
     }
Index: lldb/source/Core/IOHandler.cpp
===================================================================
--- lldb/source/Core/IOHandler.cpp
+++ lldb/source/Core/IOHandler.cpp
@@ -329,10 +329,9 @@
           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 @@
       // 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();
Index: lldb/source/API/SBDebugger.cpp
===================================================================
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -467,10 +467,8 @@
 
     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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68444.224180.patch
Type: text/x-patch
Size: 2260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/71caa2f2/attachment-0001.bin>


More information about the lldb-commits mailing list