aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorPete Lawrence <plawrence@apple.com>2024-01-23 14:07:52 -1000
committerGitHub <noreply@github.com>2024-01-23 16:07:52 -0800
commitd657519838e4b2310e13ec5ff52599e041860825 (patch)
treed6e6a1747477c4afbf0f4f77ef3d60df41e8ca47 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent25e1916d88ebeef786956b678a4eb9a757e219d9 (diff)
downloadllvm-d657519838e4b2310e13ec5ff52599e041860825.zip
llvm-d657519838e4b2310e13ec5ff52599e041860825.tar.gz
llvm-d657519838e4b2310e13ec5ff52599e041860825.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions