diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-11-09 15:25:59 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-11-09 15:42:27 -0800 |
commit | b2fa3b922ecb219429ec7b839d15a06aedbc955a (patch) | |
tree | 266e4fc62625a1487f7620934bbc6b57fdf32d09 /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | 554939583a122c48e8c3ffa1bff734b3ce963627 (diff) | |
download | llvm-b2fa3b922ecb219429ec7b839d15a06aedbc955a.zip llvm-b2fa3b922ecb219429ec7b839d15a06aedbc955a.tar.gz llvm-b2fa3b922ecb219429ec7b839d15a06aedbc955a.tar.bz2 |
[lldb] Make GetSelectedOrDummyTarget return the target by reference (NFC)
Return references from GetDummyTarget and GetSelectedOrDummyTarget. This
matches how the APIs are already used in practice.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index d6b4b89..4d33d17 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1523,16 +1523,12 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) { end_backtick - expr_content_start); ExecutionContext exe_ctx(GetExecutionContext()); - Target *target = exe_ctx.GetTargetPtr(); // Get a dummy target to allow for calculator mode while processing // backticks. This also helps break the infinite loop caused when target is // null. - if (!target) - target = m_debugger.GetDummyTarget(); - - if (!target) - continue; + Target *exe_target = exe_ctx.GetTargetPtr(); + Target &target = exe_target ? *exe_target : m_debugger.GetDummyTarget(); ValueObjectSP expr_result_valobj_sp; @@ -1545,8 +1541,8 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) { options.SetTimeout(llvm::None); ExpressionResults expr_result = - target->EvaluateExpression(expr_str.c_str(), exe_ctx.GetFramePtr(), - expr_result_valobj_sp, options); + target.EvaluateExpression(expr_str.c_str(), exe_ctx.GetFramePtr(), + expr_result_valobj_sp, options); if (expr_result == eExpressionCompleted) { Scalar scalar; |