diff options
author | Dave Lee <davelee.com@gmail.com> | 2022-01-13 21:17:02 -0800 |
---|---|---|
committer | Dave Lee <davelee.com@gmail.com> | 2022-09-02 08:53:46 -0700 |
commit | a2ec18ee043f7c8caa0e9e329721182b9f1a5dcd (patch) | |
tree | f81082d13999ff2daeffda4c2d7e5c4280386406 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 5203168f91f3bb5644fd6373e07c8e251ff4e1e9 (diff) | |
download | llvm-a2ec18ee043f7c8caa0e9e329721182b9f1a5dcd.zip llvm-a2ec18ee043f7c8caa0e9e329721182b9f1a5dcd.tar.gz llvm-a2ec18ee043f7c8caa0e9e329721182b9f1a5dcd.tar.bz2 |
[lldb] From unordered_map synthetic provider, return std::pair children
Change the behavior of the libc++ `unordered_map` synthetic provider to present
children as `std::pair` values, just like `std::map` does.
The synthetic provider for libc++ `std::unordered_map` has returned children
that expose a level of internal structure (over top of the key/value pair). For
example, given an unordered map initialized with `{{1,2}, {3, 4}}`, the output
is:
```
(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
[0] = {
__cc = (first = 3, second = 4)
}
[1] = {
__cc = (first = 1, second = 2)
}
}
```
It's not ideal/necessary to have the numbered children embdedded in the `__cc`
field.
Note: the numbered children have type
`std::__hash_node<std::__hash_value_type<Key, T>, void *>::__node_value_type`,
and the `__cc` fields have type `std::__hash_value_type<Key, T>::value_type`.
Compare this output to `std::map`:
```
(std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
[0] = (first = 1, second = 2)
[1] = (first = 3, second = 4)
```
Where the numbered children have type `std::pair<const Key, T>`.
This changes the behavior of the synthetic provider for `unordered_map` to also
present children as `pairs`, just like `std::map`.
It appears the synthetic provider implementation for `unordered_map` was meant
to provide this behavior, but was maybe incomplete (see
d22a94377f7554a7e9df050f6dfc3ee42384e3fe). It has both an `m_node_type` and an
`m_element_type`, but uses only the former. The latter is exactly the type
needed for the children pairs. With this existing code, it's not much of a
change to make this work.
Differential Revision: https://reviews.llvm.org/D117383
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions