summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authorKonrad Kleine <kkleine@redhat.com>2019-11-28 16:54:15 +0100
committerKonrad Kleine <kkleine@redhat.com>2019-11-28 21:37:31 +0100
commitc671639af6a96c31d3c0e5487051bef28bad1640 (patch)
treea9bfbff7b14d2ec0d8c9189533e57c94a7c0d6c9 /lldb/source/API/SBThread.cpp
parentbdad3ec75ab35ade2433b1278689d483dcf9abc4 (diff)
downloadbcm5719-llvm-c671639af6a96c31d3c0e5487051bef28bad1640.tar.gz
bcm5719-llvm-c671639af6a96c31d3c0e5487051bef28bad1640.zip
[lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Summary: I found the above named method hard to read because it had a) many nested blocks, b) one return statement at the end with some logic involved, c) a duplicated while-loop with just small differences in it. I decided to refactor this function by employing an early exit strategy. In order to capture the logic in the return statement and to not have it repeated more than once I chose to implement a very small lamda function that captures all the variables it needs. I also replaced the two while-loops with just one. This is a non-functional change (NFC). Reviewers: jdoerfert, teemperor Reviewed By: teemperor Subscribers: labath, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70774
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r--lldb/source/API/SBThread.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 8d4930bf6ed..2dada9a6118 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -914,9 +914,10 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
const bool exact = false;
SymbolContextList sc_list;
- const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
- step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
- sc_list);
+ frame_sc.comp_unit->ResolveSymbolContext(step_file_spec, line,
+ check_inlines, exact,
+ eSymbolContextLineEntry, sc_list);
+ const uint32_t num_matches = sc_list.GetSize();
if (num_matches > 0) {
SymbolContext sc;
for (uint32_t i = 0; i < num_matches; ++i) {
OpenPOWER on IntegriCloud