[Lldb-commits] [PATCH] D117383: [lldb] From unordered_map synthetic provider, return std::pair children
Dave Lee via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 14 20:47:20 PST 2022
kastiglione added inline comments.
================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp:128
+ // __cc is a field of __hash_value_type, which is a typedef.
+ if (name == "__cc")
+ m_element_type = key_value_type.GetTypedefedType();
----------------
This block of changes is needed to support `unordered_set`, because this synthetic provider is shared by `unordered_set` and `unordered_map`.
For `unordered_map`, the element type is an internal hash node. For `unoredered_set`, it's the type `T` from `unordered_set<T>`. This part of the code needs to know whether there's a hash node here, and to step down through the `__cc` field.
I am not sure what the best way to do this is. I could do a string prefix check against `std::__hash_value_type`. I could do a smarter full string equality check, but could that possibly have false negatives if the wrong string type name is constructed. As it currently is, I assume if there's a one or more fields, and if the first one is named `__cc`, then it's assumed to be an internal hash node.
Suggestions welcome.
================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp:162
return CreateValueObjectFromData(stream.GetString(), data, exe_ctx,
- val_hash.first->GetCompilerType());
+ m_element_type);
}
----------------
This change is the fix needed to get `unordered_map` working.
================
Comment at: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/TestDataFormatterGenericUnordered.py:51
+ must_not_contain__cc = r'(?s)^(?!.*\b__cc = )'
+
----------------
This regex checks that the string `__cc = ` is not in the output.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117383/new/
https://reviews.llvm.org/D117383
More information about the lldb-commits
mailing list