diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-06-25 09:51:55 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-06-25 09:55:46 -0700 |
commit | 842283652eb89e7c207ecfdac5e546472332f02b (patch) | |
tree | 99ac33ddd87880faa65a31ba926fbf151b088823 /lldb/source/Interpreter/ScriptInterpreter.cpp | |
parent | 79d7e9c7d07a7ba4a65f4579bf3a8756c757e634 (diff) | |
download | llvm-842283652eb89e7c207ecfdac5e546472332f02b.zip llvm-842283652eb89e7c207ecfdac5e546472332f02b.tar.gz llvm-842283652eb89e7c207ecfdac5e546472332f02b.tar.bz2 |
[lldb/ScriptInterpreter] Let the IORedirect factory handle IO being disabled.
Have one factory method that decides how to initialize the
ScriptInterpreterIORedirect object based on whether IO is enabled or
disabled.
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreter.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index d46a104..967c228 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -119,7 +119,12 @@ static void ReadThreadBytesReceived(void *baton, const void *src, } llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>> -ScriptInterpreterIORedirect::Create() { +ScriptInterpreterIORedirect::Create(bool enable_io, Debugger &debugger, + CommandReturnObject *result) { + if (enable_io) + return std::unique_ptr<ScriptInterpreterIORedirect>( + new ScriptInterpreterIORedirect(debugger, result)); + auto nullin = FileSystem::Instance().Open(FileSpec(FileSystem::DEV_NULL), File::eOpenOptionRead); if (!nullin) @@ -134,13 +139,6 @@ ScriptInterpreterIORedirect::Create() { new ScriptInterpreterIORedirect(std::move(*nullin), std::move(*nullout))); } -llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>> -ScriptInterpreterIORedirect::Create(Debugger &debugger, - CommandReturnObject *result) { - return std::unique_ptr<ScriptInterpreterIORedirect>( - new ScriptInterpreterIORedirect(debugger, result)); -} - ScriptInterpreterIORedirect::ScriptInterpreterIORedirect( std::unique_ptr<File> input, std::unique_ptr<File> output) : m_input_file_sp(std::move(input)), |