[Lldb-commits] [PATCH] D129364: [LLDB][DataFormatter] Add data formatter for libcxx std::unordered_map iterator

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 8 04:51:38 PDT 2022


Michael137 created this revision.
Michael137 added reviewers: aprantl, jingham.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch adds a formatter for libcxx's `std::unordered_map` iterators.
The implementation follows a similar appraoch to the `std::map` iterator
formatter. I was hesistant about coupling the two into a common
implementation since the libcxx layouts might change for one of the
the containers but not the other.

All `std::unordered_map` iterators are covered with this patch:

1. const/non-const key/value iterators
2. const/non-const bucket iterators

Note that, we currently don't have a formatter for `std::unordered_map`.
This patch doesn't change that, we merely add support for its iterators,
because that's what Xcode users requested. One can still see contents
of `std::unordered_map`, whereas with iterators it's less ergonomic.

**Testing**

- Added API test


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129364

Files:
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/Makefile
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129364.443208.patch
Type: text/x-patch
Size: 13447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220708/b28a0da4/attachment-0001.bin>


More information about the lldb-commits mailing list