llvm-capstone/lldb
Pete Lawrence d657519838
[lldb] Improve maintainability and readability for ValueObject methods (#75865)
As I worked through changes to another PR
(https://github.com/llvm/llvm-project/pull/74912), I couldn't help but
rewrite a few methods for readability, maintainability, and possibly
some behavior correctness too.

1. Exiting early instead of nested `if`-statements, which:
	- Reduces indentation levels for all subsequent lines
	- Treats missing pre-conditions similar to an error
- Clearly indicates that the full length of the method is the "happy
path".
2. Explicitly return empty Value Object shared pointers for those error
(like) situations, which
- Reduces the time it takes a maintainer to figure out what the method
actually returns based on those conditions.

3. Converting a mix of `if` and `if`-`else`-statements around an enum
into one `switch` statement, which:
	- Consolidates the former branching logic
	- Lets the compiler warn you of a (future) missing enum case
- This one may actually change behavior slightly, because what was an
early test for one enum case, now happens later on in the `switch`.

4. Consolidating near-identical, "copy-pasta" logic into one place,
which:
	- Separates the common code to the diverging paths.
	- Highlights the differences between the code paths.



rdar://119833526
2024-01-23 16:07:52 -08:00
..
bindings [lldb] Use StringRef::starts_with (NFC) 2023-12-17 15:51:48 -08:00
cmake [lldb] Silence warning with latest MSVC 2024-01-18 13:06:12 -05:00
docs Remove hardware index from watchpoints and breakpoints (#72012) 2023-11-15 13:32:42 -08:00
examples [lldb] Pass important options to dsymForUUID (#72669) 2023-11-17 08:00:07 -08:00
include [lldb][NFCI] Remove unused method BreakpointIDList::AddBreakpointID(const char *) (#79189) 2024-01-23 13:41:36 -08:00
packages/Python/lldbsuite [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (#73067) 2024-01-19 10:50:05 -06:00
resources
scripts [lldb] Replace the usage of module imp with module importlib (#70443) 2023-10-31 17:08:55 -03:00
source [lldb] Improve maintainability and readability for ValueObject methods (#75865) 2024-01-23 16:07:52 -08:00
test [lldb][libc++] Adds system_clock data formatters. (#78609) 2024-01-22 20:25:14 +01:00
third_party/Python/module
tools [lldb] Fix build error in lldb-dap.cpp (NFC) 2024-01-20 08:09:20 +08:00
unittests [lldb][DWARFUnit] Implement PeekDIEName query (#78486) 2024-01-19 16:11:08 -08:00
utils
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (#76137) 2023-12-22 00:40:12 +02:00
CodeOwners.rst
LICENSE.TXT
use_lldb_suite_root.py