[all-commits] [llvm/llvm-project] 9dca3a: [lldb][DataFormatter] Simplify libc++ std::map::it...

Michael Buch via All-commits all-commits at lists.llvm.org
Mon Jul 8 07:56:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9dca3ac2efb180398ef8e84bfa9f0ef283d0e6fd
      https://github.com/llvm/llvm-project/commit/9dca3ac2efb180398ef8e84bfa9f0ef283d0e6fd
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
    M lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py

  Log Message:
  -----------
  [lldb][DataFormatter] Simplify libc++ std::map::iterator formatter (#97713)

Depends on https://github.com/llvm/llvm-project/pull/97687

Similar to https://github.com/llvm/llvm-project/pull/97579, this patch
simplifies the way in which we retrieve the key/value pair of a
`std::map` (in this case of the `std::map::iterator`).

We do this for the same reason: not only was the old logic hard to
follow, and encoded the libc++ layout in non-obvious ways, it was also
fragile to alignment miscalculations
(https://github.com/llvm/llvm-project/pull/97443); this would break once
the new layout of std::map landed as part of
https://github.com/llvm/llvm-project/issues/93069.

Instead, this patch simply casts the `__iter_pointer` to the
`__node_pointer` and uses a straightforward
`GetChildMemberWithName("__value_")` to get to the key/value we care
about.

We can eventually re-use the core-part of the `std::map` and
`std::map::iterator` formatters. But it will be an easier to change to
review once both simplifications landed.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list