diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-09-27 14:33:35 +0000 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-09-27 14:33:35 +0000 |
commit | 7ca15ba73f67f1d3b6652cb19bbf78731e3b128d (patch) | |
tree | 0465ddf922beeeafd09260e5e7b47f55ab0b7e99 /lldb/source/Expression | |
parent | eb4c98ca3d2590bad9f6542afbf3a7824d2b53fa (diff) | |
download | bcm5719-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/Expression')
-rw-r--r-- | lldb/source/Expression/REPL.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index cfa520981be..78e46881023 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -96,7 +96,7 @@ void REPL::IOHandlerActivated(IOHandler &io_handler, bool interactive) { lldb::ProcessSP process_sp = m_target.GetProcessSP(); if (process_sp && process_sp->IsAlive()) return; - lldb::StreamFileSP error_sp(io_handler.GetErrorStreamFile()); + lldb::StreamFileSP error_sp(io_handler.GetErrorStreamFileSP()); error_sp->Printf("REPL requires a running target process.\n"); io_handler.SetIsDone(true); } @@ -180,8 +180,8 @@ int REPL::IOHandlerFixIndentation(IOHandler &io_handler, } void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { - lldb::StreamFileSP output_sp(io_handler.GetOutputStreamFile()); - lldb::StreamFileSP error_sp(io_handler.GetErrorStreamFile()); + lldb::StreamFileSP output_sp(io_handler.GetOutputStreamFileSP()); + lldb::StreamFileSP error_sp(io_handler.GetErrorStreamFileSP()); bool extra_line = false; bool did_quit = false; @@ -398,11 +398,11 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { // Update our code on disk if (!m_repl_source_path.empty()) { - auto file = FileSystem::Instance().Open(FileSpec(m_repl_source_path), - File::eOpenOptionWrite | - File::eOpenOptionTruncate | - File::eOpenOptionCanCreate, - lldb::eFilePermissionsFileDefault); + auto file = FileSystem::Instance().Open( + FileSpec(m_repl_source_path), + File::eOpenOptionWrite | File::eOpenOptionTruncate | + File::eOpenOptionCanCreate, + lldb::eFilePermissionsFileDefault); if (file) { std::string code(m_code.CopyList()); code.append(1, '\n'); |