HomePhabricator

[lldb] NFC: refactor CompileUnit::ResolveSymbolContext

Authored by kwk on Nov 28 2019, 7:54 AM.

Description

[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

Details

Committed
kwkNov 28 2019, 12:37 PM
Reviewer
teemperor
Differential Revision
D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Parents
rGbdad3ec75ab3: [LLDB] On Windows, force error message formatting to English
Branches
Unknown
Tags
Unknown