[Lldb-commits] [lldb] [lldb][test] Fix unordered-map test (PR #156033)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 11 09:11:04 PDT 2025


Michael137 wrote:

Ok so I looked at this with @da-viper offline. This is an existing issue with formatting specifically `const std::unordered_map<..> *`. I added the test as part of this issue: https://github.com/llvm/llvm-project/issues/146040. The following is the discrepancy:
```
(lldb) frame var ptr -P 1
(std::unordered_map<int, int> *) ptr = 0x000000016fdff040 size=1 {
  [0] = (first = 1, second = 2)
}
(lldb) frame var const_ptr -P 1
(const std::unordered_map<int, int> *) const_ptr = 0x000000016fdff040 size=1 {
  [0] = {
    __cc_ = (first = 1, second = 2)
  }
}
```

The `__cc_` member on `hash_value_type` was actually removed altogether in a [very recent version of libc++](https://github.com/llvm/llvm-project/pull/143501). So, as I mentioned in https://github.com/llvm/llvm-project/issues/146040#issuecomment-3027283454, this works just fine on top-of-tree, because we no longer have the `__cc_` wrapper in libc++. And I decided not to give that issue more attention because we *try* to test the API-tests against the latest libc++ version, where the test failure wouldn't reproduce. The issue that @da-viper is seeing when running tests is explicitly when running a libc++ API test without a locally built libc++. Then it falls back to the system libc++, which doesn't contain the latest libc++ patch that makes this whole thing work.

So TL;DR, this is not a regression. This just didn't work prior to https://github.com/llvm/llvm-project/pull/143501, but we never noticed cause there was no test for it.

It would still be interesting to know why this fails when using older libc++. I think @da-viper is investigating further why our unordered_map formatter breaks on const pointers.

A separate question, should we allow running the libc++ API test category without a locally built libc++?

https://github.com/llvm/llvm-project/pull/156033


More information about the lldb-commits mailing list