summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-10-14 20:15:34 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-10-14 20:15:34 +0000
commit62c9fe4273e8f2a0f3f0f4c86de3a90668532354 (patch)
tree50c6f7a76ff044c13465b9ad7583558d6c275e1d /lldb/source/API
parent322f12afc3673fc868899857b069ce59084dba05 (diff)
downloadbcm5719-llvm-62c9fe4273e8f2a0f3f0f4c86de3a90668532354.tar.gz
bcm5719-llvm-62c9fe4273e8f2a0f3f0f4c86de3a90668532354.zip
uint32_t options -> File::OpenOptions options
Summary: This patch re-types everywhere that passes a File::OpenOptions as a uint32_t so it actually uses File::OpenOptions. It also converts some OpenOptions related functions that fail by returning 0 or NULL into llvm::Expected split off from https://reviews.llvm.org/D68737 Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68853 llvm-svn: 374817
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBFile.cpp7
-rw-r--r--lldb/source/API/SBStream.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/API/SBFile.cpp b/lldb/source/API/SBFile.cpp
index 5c003bc3879..739de40b6e0 100644
--- a/lldb/source/API/SBFile.cpp
+++ b/lldb/source/API/SBFile.cpp
@@ -31,7 +31,12 @@ SBFile::SBFile(int fd, const char *mode, bool transfer_owndership) {
LLDB_RECORD_DUMMY(void, SBFile, (int, const char *, bool), fd, mode,
transfer_owndership);
auto options = File::GetOptionsFromMode(mode);
- m_opaque_sp = std::make_shared<NativeFile>(fd, options, transfer_owndership);
+ if (!options) {
+ llvm::consumeError(options.takeError());
+ return;
+ }
+ m_opaque_sp =
+ std::make_shared<NativeFile>(fd, options.get(), transfer_owndership);
}
SBError SBFile::Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read) {
diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp
index 910563824a8..e7c726b90cd 100644
--- a/lldb/source/API/SBStream.cpp
+++ b/lldb/source/API/SBStream.cpp
@@ -82,7 +82,7 @@ void SBStream::RedirectToFile(const char *path, bool append) {
if (!m_is_file)
local_data = static_cast<StreamString *>(m_opaque_up.get())->GetString();
}
- uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
+ auto open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
if (append)
open_options |= File::eOpenOptionAppend;
else
OpenPOWER on IntegriCloud