summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-09-27 14:33:35 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-09-27 14:33:35 +0000
commit7ca15ba73f67f1d3b6652cb19bbf78731e3b128d (patch)
tree0465ddf922beeeafd09260e5e7b47f55ab0b7e99 /lldb/source/Host
parenteb4c98ca3d2590bad9f6542afbf3a7824d2b53fa (diff)
downloadbcm5719-llvm-7ca15ba73f67f1d3b6652cb19bbf78731e3b128d.tar.gz
bcm5719-llvm-7ca15ba73f67f1d3b6652cb19bbf78731e3b128d.zip
remove File::SetStream(), make new files instead.
Summary: This patch removes File::SetStream() and File::SetDescriptor(), and replaces most direct uses of File with pointers to File. Instead of calling SetStream() on a file, we make a new file and replace it. My ultimate goal here is to introduce a new API class SBFile, which has full support for python io.IOStream file objects. These can redirect read() and write() to python code, so lldb::Files will need a way to dispatch those methods. Additionally it will need some form of sharing and assigning files, as a SBFile will be passed in and assigned to the main IO streams of the debugger. In my prototype patch queue, I make File itself copyable and add a secondary class FileOps to manage the sharing and dispatch. In that case SBFile was a unique_ptr<File>. (here: https://github.com/smoofra/llvm-project/tree/files) However in review, Pavel Labath suggested that it be shared_ptr instead. (here: https://reviews.llvm.org/D67793) In order for SBFile to use shared_ptr<File>, everything else should as well. If this patch is accepted, I will make SBFile use a shared_ptr I will remove FileOps from future patches and use subclasses of File instead. Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67891 llvm-svn: 373090
Diffstat (limited to 'lldb/source/Host')
-rw-r--r--lldb/source/Host/common/File.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index 824f088430e..7560f1d2752 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -93,14 +93,6 @@ int File::GetDescriptor() const {
IOObject::WaitableHandle File::GetWaitableHandle() { return GetDescriptor(); }
-void File::SetDescriptor(int fd, uint32_t options, bool transfer_ownership) {
- if (IsValid())
- Close();
- m_descriptor = fd;
- m_should_close_fd = transfer_ownership;
- m_options = options;
-}
-
FILE *File::GetStream() {
if (!StreamIsValid()) {
if (DescriptorIsValid()) {
@@ -133,13 +125,6 @@ FILE *File::GetStream() {
return m_stream;
}
-void File::SetStream(FILE *fh, bool transfer_ownership) {
- if (IsValid())
- Close();
- m_stream = fh;
- m_own_stream = transfer_ownership;
-}
-
uint32_t File::GetPermissions(Status &error) const {
int fd = GetDescriptor();
if (fd != kInvalidDescriptor) {
OpenPOWER on IntegriCloud