[lldb] Make Target* a Target& in CommandObjectExpression::DoExecute REPL logic

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70002
This commit is contained in:
Raphael Isemann 2019-11-08 12:28:49 +01:00
parent 79b3cce7f1
commit 5a1bac4d1d
1 changed files with 46 additions and 48 deletions

View File

@ -589,13 +589,12 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command,
return false; return false;
if (m_repl_option.GetOptionValue().GetCurrentValue()) { if (m_repl_option.GetOptionValue().GetCurrentValue()) {
Target *target = m_interpreter.GetExecutionContext().GetTargetPtr(); Target &target = GetSelectedOrDummyTarget();
if (target) {
// Drop into REPL // Drop into REPL
m_expr_lines.clear(); m_expr_lines.clear();
m_expr_line_count = 0; m_expr_line_count = 0;
Debugger &debugger = target->GetDebugger(); Debugger &debugger = target.GetDebugger();
// Check if the LLDB command interpreter is sitting on top of a REPL // Check if the LLDB command interpreter is sitting on top of a REPL
// that launched it... // that launched it...
@ -610,12 +609,12 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command,
// interpreter, so just push one // interpreter, so just push one
bool initialize = false; bool initialize = false;
Status repl_error; Status repl_error;
REPLSP repl_sp(target->GetREPL(repl_error, m_command_options.language, REPLSP repl_sp(target.GetREPL(repl_error, m_command_options.language,
nullptr, false)); nullptr, false));
if (!repl_sp) { if (!repl_sp) {
initialize = true; initialize = true;
repl_sp = target->GetREPL(repl_error, m_command_options.language, repl_sp = target.GetREPL(repl_error, m_command_options.language,
nullptr, true); nullptr, true);
if (!repl_error.Success()) { if (!repl_error.Success()) {
result.SetError(repl_error); result.SetError(repl_error);
@ -645,7 +644,6 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command,
} }
} }
} }
}
// No expression following options // No expression following options
else if (expr.empty()) { else if (expr.empty()) {
GetMultilineExpression(); GetMultilineExpression();