aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2024-07-08 14:38:58 +0100
committerGitHub <noreply@github.com>2024-07-08 14:38:58 +0100
commitda827d0896e5e66fe9130f8f4479537d3bbee1da (patch)
treec70f852dfff4c8c8dbf546d5c301b6e5ea7cf64e /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent83b01aaf51072a07261ee2e5fc14102f71273bc0 (diff)
downloadllvm-da827d0896e5e66fe9130f8f4479537d3bbee1da.zip
llvm-da827d0896e5e66fe9130f8f4479537d3bbee1da.tar.gz
llvm-da827d0896e5e66fe9130f8f4479537d3bbee1da.tar.bz2
[lldb][DataFormatter] Simplify std::unordered_map::iterator formatter (#97754)
Depends on https://github.com/llvm/llvm-project/pull/97752 This patch changes the way we retrieve the key/value pair in the `std::unordered_map::iterator` formatter (similar to how we are changing it for `std::map::iterator` in https://github.com/llvm/llvm-project/pull/97713, the motivations being the same). The old logic was not very easy to follow, and encoded the libc++ layout in non-obvious ways. But mainly it was also fragile to alignment miscalculations (https://github.com/llvm/llvm-project/pull/97443); this would break once the new layout of `std::unordered_map` landed as part of https://github.com/llvm/llvm-project/issues/93069. Instead, this patch simply casts the `__hash_iterator` to a `__node_pointer` (which is what libc++ does too) and uses a straightforward `GetChildMemberWithName("__value_")` to get to the key/value we care about. The `std::unordered_map` already does it this way, so we align the iterator counterpart to do the same. We can eventually re-use the core-part of the `std::unordered_map` and `std::unordered_map::iterator` formatters. But it will be an easier to change to review once both simplifications landed.
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions