summaryrefslogtreecommitdiff
path: root/source/API/SBStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBStream.cpp')
-rw-r--r--source/API/SBStream.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp
index d1af77a40fa3..876ef02170d2 100644
--- a/source/API/SBStream.cpp
+++ b/source/API/SBStream.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
@@ -24,12 +25,12 @@ SBStream::SBStream(SBStream &&rhs)
SBStream::~SBStream() {}
-bool SBStream::IsValid() const { return (m_opaque_ap.get() != NULL); }
+bool SBStream::IsValid() const { return (m_opaque_ap != NULL); }
// If this stream is not redirected to a file, it will maintain a local cache
// for the stream data which can be accessed using this accessor.
const char *SBStream::GetData() {
- if (m_is_file || m_opaque_ap.get() == NULL)
+ if (m_is_file || m_opaque_ap == NULL)
return NULL;
return static_cast<StreamString *>(m_opaque_ap.get())->GetData();
@@ -38,7 +39,7 @@ const char *SBStream::GetData() {
// If this stream is not redirected to a file, it will maintain a local cache
// for the stream output whose length can be accessed using this accessor.
size_t SBStream::GetSize() {
- if (m_is_file || m_opaque_ap.get() == NULL)
+ if (m_is_file || m_opaque_ap == NULL)
return 0;
return static_cast<StreamString *>(m_opaque_ap.get())->GetSize();
@@ -58,7 +59,7 @@ void SBStream::RedirectToFile(const char *path, bool append) {
return;
std::string local_data;
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@@ -70,12 +71,12 @@ void SBStream::RedirectToFile(const char *path, bool append) {
open_options |= File::eOpenOptionAppend;
else
open_options |= File::eOpenOptionTruncate;
- stream_file->GetFile().Open(path, open_options,
- lldb::eFilePermissionsFileDefault);
+ FileSystem::Instance().Open(stream_file->GetFile(), FileSpec(path),
+ open_options);
m_opaque_ap.reset(stream_file);
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@@ -91,7 +92,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
return;
std::string local_data;
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@@ -99,7 +100,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
}
m_opaque_ap.reset(new StreamFile(fh, transfer_fh_ownership));
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@@ -112,7 +113,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
void SBStream::RedirectToFileDescriptor(int fd, bool transfer_fh_ownership) {
std::string local_data;
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@@ -120,7 +121,7 @@ void SBStream::RedirectToFileDescriptor(int fd, bool transfer_fh_ownership) {
}
m_opaque_ap.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@@ -136,13 +137,13 @@ lldb_private::Stream *SBStream::operator->() { return m_opaque_ap.get(); }
lldb_private::Stream *SBStream::get() { return m_opaque_ap.get(); }
lldb_private::Stream &SBStream::ref() {
- if (m_opaque_ap.get() == NULL)
+ if (m_opaque_ap == NULL)
m_opaque_ap.reset(new StreamString());
- return *m_opaque_ap.get();
+ return *m_opaque_ap;
}
void SBStream::Clear() {
- if (m_opaque_ap.get()) {
+ if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (m_is_file)