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/CommandObjectBreakpointCommand.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/CommandObjectBreakpointCommand.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpointCommand.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index afb4fc4da1e..5988b1c5302 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -361,16 +361,9 @@ are no syntax errors may indicate that a function was declared but never called. protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy); + Target &target = GetSelectedOrDummyTarget(m_options.m_use_dummy); - if (target == nullptr) { - result.AppendError("There is not a current executable; there are no " - "breakpoints to which to add commands"); - result.SetStatus(eReturnStatusFailed); - return false; - } - - const BreakpointList &breakpoints = target->GetBreakpointList(); + const BreakpointList &breakpoints = target.GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) { @@ -389,7 +382,7 @@ protected: BreakpointIDList valid_bp_ids; CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs( - command, target, result, &valid_bp_ids, + command, &target, result, &valid_bp_ids, BreakpointName::Permissions::PermissionKinds::listPerm); m_bp_options_vec.clear(); @@ -401,7 +394,7 @@ protected: BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i); if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) { Breakpoint *bp = - target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get(); + target.GetBreakpointByID(cur_bp_id.GetBreakpointID()).get(); BreakpointOptions *bp_options = nullptr; if (cur_bp_id.GetLocationID() == LLDB_INVALID_BREAK_ID) { // This breakpoint does not have an associated location. @@ -536,16 +529,9 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy); + Target &target = GetSelectedOrDummyTarget(m_options.m_use_dummy); - if (target == nullptr) { - result.AppendError("There is not a current executable; there are no " - "breakpoints from which to delete commands"); - result.SetStatus(eReturnStatusFailed); - return false; - } - - const BreakpointList &breakpoints = target->GetBreakpointList(); + const BreakpointList &breakpoints = target.GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) { @@ -563,7 +549,7 @@ protected: BreakpointIDList valid_bp_ids; CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs( - command, target, result, &valid_bp_ids, + command, &target, result, &valid_bp_ids, BreakpointName::Permissions::PermissionKinds::listPerm); if (result.Succeeded()) { @@ -572,7 +558,7 @@ protected: BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i); if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) { Breakpoint *bp = - target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get(); + target.GetBreakpointByID(cur_bp_id.GetBreakpointID()).get(); if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) { BreakpointLocationSP bp_loc_sp( bp->FindLocationByID(cur_bp_id.GetLocationID())); |