diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-08-26 18:12:44 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-08-26 18:12:44 +0000 |
commit | cb2380c9fa4be10aaee30d0a04fd9b354b922802 (patch) | |
tree | 989627356414cb6f2b1b65cc2c43cf5e43ce7fc4 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | 8679ef4e46a4d7b46a521a905d60357854117d43 (diff) | |
download | bcm5719-llvm-cb2380c9fa4be10aaee30d0a04fd9b354b922802.tar.gz bcm5719-llvm-cb2380c9fa4be10aaee30d0a04fd9b354b922802.zip |
[lldb][NFC] Remove dead code that handles situations where LLDB has no dummy target
Summary:
We always have a dummy target, so any error handling regarding a missing dummy target is dead code now.
Also makes the CommandObject methods that return Target& to express this fact in the API.
This patch just for the CommandObject part of LLDB. I'll migrate the rest of LLDB in a follow-up patch that's WIP.
Reviewers: labath
Reviewed By: labath
Subscribers: abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66737
llvm-svn: 369939
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 752c8f642e3..7544fcef31a 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -316,10 +316,7 @@ void CommandObjectExpression::HandleCompletion(CompletionRequest &request) { Target *target = exe_ctx.GetTargetPtr(); if (!target) - target = GetDummyTarget(); - - if (!target) - return; + target = &GetDummyTarget(); unsigned cursor_pos = request.GetRawCursorPos(); llvm::StringRef code = request.GetRawLine(); @@ -380,9 +377,8 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr, Target *target = exe_ctx.GetTargetPtr(); if (!target) - target = GetDummyTarget(); + target = &GetDummyTarget(); - if (target) { lldb::ValueObjectSP result_valobj_sp; bool keep_in_memory = true; StackFrame *frame = exe_ctx.GetFramePtr(); @@ -494,10 +490,6 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr, } } } - } else { - error_stream->Printf("error: invalid execution context for expression\n"); - return false; - } return true; } @@ -662,11 +654,11 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, } } - Target *target = GetSelectedOrDummyTarget(); + Target &target = GetSelectedOrDummyTarget(); if (EvaluateExpression(expr, &(result.GetOutputStream()), &(result.GetErrorStream()), &result)) { - if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) { + if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) { CommandHistory &history = m_interpreter.GetCommandHistory(); // FIXME: Can we figure out what the user actually typed (e.g. some alias // for expr???) @@ -681,12 +673,12 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, history.AppendString(fixed_command); } // Increment statistics to record this expression evaluation success. - target->IncrementStats(StatisticKind::ExpressionSuccessful); + target.IncrementStats(StatisticKind::ExpressionSuccessful); return true; } // Increment statistics to record this expression evaluation failure. - target->IncrementStats(StatisticKind::ExpressionFailure); + target.IncrementStats(StatisticKind::ExpressionFailure); result.SetStatus(eReturnStatusFailed); return false; } |