[LLDB][DataFormatter] Add data formatter for libcxx std::unordered_map iterator
authorMichael Buch <michaelbuch12@gmail.com>
Fri, 8 Jul 2022 09:47:04 +0000 (10:47 +0100)
committerMichael Buch <michaelbuch12@gmail.com>
Tue, 12 Jul 2022 09:13:55 +0000 (10:13 +0100)
commitd1e9d0b27f3a59f80787bfe5cf10d4373275c477
tree5ae8506be3330a00b72a79a4246362c4b8a35771
parent51d3f421f48f7c888c37a13be049a4ca8b61436e
[LLDB][DataFormatter] Add data formatter for libcxx std::unordered_map iterator

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

Differential Revision: https://reviews.llvm.org/D129364
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 [new file with mode: 0644]
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py [new file with mode: 0644]
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp [new file with mode: 0644]