diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-03 04:31:46 +0000 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-03 04:31:46 +0000 |
commit | f913fd6eb0c228041b77a645d76993760d3b1421 (patch) | |
tree | 9d33e1b8a85f1fbccf83cc3f59efeed7aa4511c3 /lldb/source/API | |
parent | 96898eb6a935533aaebbfbd085150fbf705c0ffc (diff) | |
download | bcm5719-llvm-f913fd6eb0c228041b77a645d76993760d3b1421.tar.gz bcm5719-llvm-f913fd6eb0c228041b77a645d76993760d3b1421.zip |
factor out an abstract base class for File
Summary:
This patch factors out File as an abstract base
class and moves most of its actual functionality into
a subclass called NativeFile. In the next patch,
I'm going to be adding subclasses of File that
don't necessarily have any connection to actual OS files,
so they will not inherit from NativeFile.
This patch was split out as a prerequisite for
https://reviews.llvm.org/D68188
Reviewers: JDevlieghere, jasonmolenda, labath
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D68317
llvm-svn: 373564
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 8 | ||||
-rw-r--r-- | lldb/source/API/SBFile.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 97bc743ae87..b9ee5047545 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -289,7 +289,7 @@ void SBDebugger::SkipAppInitFiles(bool b) { void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) { LLDB_RECORD_METHOD(void, SBDebugger, SetInputFileHandle, (FILE *, bool), fh, transfer_ownership); - SetInputFile(std::make_shared<File>(fh, transfer_ownership)); + SetInputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership)); } // Shouldn't really be settable after initialization as this could cause lots @@ -319,7 +319,7 @@ SBError SBDebugger::SetInputFile(SBFile file) { // FIXME Jonas Devlieghere: shouldn't this error be propagated out to the // reproducer somehow if fh is NULL? if (fh) { - file_sp = std::make_shared<File>(fh, true); + file_sp = std::make_shared<NativeFile>(fh, true); } } @@ -335,7 +335,7 @@ SBError SBDebugger::SetInputFile(SBFile file) { void SBDebugger::SetOutputFileHandle(FILE *fh, bool transfer_ownership) { LLDB_RECORD_METHOD(void, SBDebugger, SetOutputFileHandle, (FILE *, bool), fh, transfer_ownership); - SetOutputFile(std::make_shared<File>(fh, transfer_ownership)); + SetOutputFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership)); } SBError SBDebugger::SetOutputFile(SBFile file) { @@ -356,7 +356,7 @@ SBError SBDebugger::SetOutputFile(SBFile file) { void SBDebugger::SetErrorFileHandle(FILE *fh, bool transfer_ownership) { LLDB_RECORD_METHOD(void, SBDebugger, SetErrorFileHandle, (FILE *, bool), fh, transfer_ownership); - SetErrorFile(std::make_shared<File>(fh, transfer_ownership)); + SetErrorFile((FileSP)std::make_shared<NativeFile>(fh, transfer_ownership)); } SBError SBDebugger::SetErrorFile(SBFile file) { diff --git a/lldb/source/API/SBFile.cpp b/lldb/source/API/SBFile.cpp index b36dedb628f..07122916d23 100644 --- a/lldb/source/API/SBFile.cpp +++ b/lldb/source/API/SBFile.cpp @@ -21,14 +21,14 @@ SBFile::SBFile(FileSP file_sp) : m_opaque_sp(file_sp) {} SBFile::SBFile() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFile); } SBFile::SBFile(FILE *file, bool transfer_ownership) { - m_opaque_sp = std::make_shared<File>(file, transfer_ownership); + m_opaque_sp = std::make_shared<NativeFile>(file, transfer_ownership); } SBFile::SBFile(int fd, const char *mode, bool transfer_owndership) { LLDB_RECORD_CONSTRUCTOR(SBFile, (int, const char *, bool), fd, mode, transfer_owndership); auto options = File::GetOptionsFromMode(mode); - m_opaque_sp = std::make_shared<File>(fd, options, transfer_owndership); + m_opaque_sp = std::make_shared<NativeFile>(fd, options, transfer_owndership); } SBError SBFile::Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read) { |