diff options
| author | Konrad Kleine <kkleine@redhat.com> | 2019-11-27 10:57:06 +0100 |
|---|---|---|
| committer | Konrad Kleine <kkleine@redhat.com> | 2019-11-28 14:00:38 +0100 |
| commit | 373e2a4f69d623e59329ff801f261d8b299e12d2 (patch) | |
| tree | 30ff319f830fd7a30fbfdc3feeaab506c56e8210 /lldb/source/Core | |
| parent | 3c3aca245e67fa70b6f49b9062983fbdf120ba04 (diff) | |
| download | bcm5719-llvm-373e2a4f69d623e59329ff801f261d8b299e12d2.tar.gz bcm5719-llvm-373e2a4f69d623e59329ff801f261d8b299e12d2.zip | |
[lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Summary:
I found the above named method hard to read because it had
a) many nested blocks and
b) one return statement at the end with some logic involved.
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.
This is a non-functional change (NFC).
Reviewers: jdoerfert
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70774
Diffstat (limited to 'lldb/source/Core')
| -rw-r--r-- | lldb/source/Core/AddressResolverFileLine.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp index 4a14260c6c7..4122b5d3b74 100644 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -40,14 +40,13 @@ Searcher::CallbackReturn AddressResolverFileLine::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) { SymbolContextList sc_list; - uint32_t sc_list_size; CompileUnit *cu = context.comp_unit; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); - sc_list_size = - cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false, - eSymbolContextEverything, sc_list); + cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false, + eSymbolContextEverything, sc_list); + uint32_t sc_list_size = sc_list.GetSize(); for (uint32_t i = 0; i < sc_list_size; i++) { SymbolContext sc; if (sc_list.GetContextAtIndex(i, sc)) { |

