Use Host::File in lldb_private::StreamFile and other places to cleanup host
layer a bit more.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125149 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 6901fa2..430700d 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -193,7 +193,7 @@
SBDebugger::GetInputFileHandle ()
{
if (m_opaque_sp)
- return m_opaque_sp->GetInputFileHandle();
+ return m_opaque_sp->GetInputFile().GetStream();
return NULL;
}
@@ -201,7 +201,7 @@
SBDebugger::GetOutputFileHandle ()
{
if (m_opaque_sp)
- return m_opaque_sp->GetOutputFileHandle();
+ return m_opaque_sp->GetOutputFile().GetStream();
return NULL;
}
@@ -209,7 +209,7 @@
SBDebugger::GetErrorFileHandle ()
{
if (m_opaque_sp)
- return m_opaque_sp->GetErrorFileHandle();
+ return m_opaque_sp->GetErrorFile().GetStream();
return NULL;
}
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 01718a3..df3a753 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -103,7 +103,7 @@
if (m_opaque_sp)
{
- StreamFile out_stream (out);
+ StreamFile out_stream (out, false);
m_opaque_sp->Dump (&out_stream, true, NULL, 0, NULL, false);
}
}
diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp
index b8a18a1..661c0f0 100644
--- a/source/API/SBStream.cpp
+++ b/source/API/SBStream.cpp
@@ -9,6 +9,7 @@
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
@@ -75,7 +76,13 @@
if (!m_is_file)
local_data.swap(static_cast<StreamString *>(m_opaque_ap.get())->GetString());
}
- m_opaque_ap.reset (new StreamFile (path, append ? "a" : "w"));
+ StreamFile *stream_file = new StreamFile;
+ uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
+ if (append)
+ open_options |= File::eOpenOptionAppend;
+ stream_file->GetFile().Open (path, open_options, File::ePermissionsDefault);
+
+ m_opaque_ap.reset (stream_file);
if (m_opaque_ap.get())
{