[lldb/API] Add SBCommandInterpreterRunResult

This adds an RunCommandInterpreter overload that returns an instance of
SBCommandInterpreterRunResults. The goal is to avoid having to add more
and more overloads when we need more output arguments.

Differential revision: https://reviews.llvm.org/D79120
This commit is contained in:
Jonas Devlieghere
2020-05-01 13:23:51 -07:00
parent 0ee7b7e3f1
commit 4c67b11918
6 changed files with 136 additions and 32 deletions

View File

@@ -1200,6 +1200,22 @@ void SBDebugger::RunCommandInterpreter(bool auto_handle_events,
}
}
SBCommandInterpreterRunResult SBDebugger::RunCommandInterpreter(
const SBCommandInterpreterRunOptions &options) {
LLDB_RECORD_METHOD(lldb::SBCommandInterpreterRunResult, SBDebugger,
RunCommandInterpreter,
(const lldb::SBCommandInterpreterRunOptions &), options);
if (!m_opaque_sp)
return LLDB_RECORD_RESULT(SBCommandInterpreterRunResult());
CommandInterpreter &interp = m_opaque_sp->GetCommandInterpreter();
CommandInterpreterRunResult result =
interp.RunCommandInterpreter(options.ref());
return LLDB_RECORD_RESULT(SBCommandInterpreterRunResult(result));
}
SBError SBDebugger::RunREPL(lldb::LanguageType language,
const char *repl_options) {
LLDB_RECORD_METHOD(lldb::SBError, SBDebugger, RunREPL,
@@ -1826,6 +1842,9 @@ template <> void RegisterMethods<SBDebugger>(Registry &R) {
(lldb::SBTypeNameSpecifier));
LLDB_REGISTER_METHOD(bool, SBDebugger, EnableLog,
(const char *, const char **));
LLDB_REGISTER_METHOD(lldb::SBCommandInterpreterRunResult, SBDebugger,
RunCommandInterpreter,
(const lldb::SBCommandInterpreterRunOptions &));
}
} // namespace repro