llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl
Jordan Rupprecht 3c51ea3619 [DataFormatter] Fix variant npos with `_LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION` enabled.
This data formatter should print "No Value" if a variant is unset. It does so by checking if `__index` has a value of `-1`, however it does so by interpreting it as a signed int.

By default, `__index` has type `unsigned int`. When `_LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION` is enabled, the type of `__index` is either `unsigned char`, `unsigned short`, or `unsigned int`, depending on how many fields there are -- as small as possible. For example, when `std::variant` has only a few types, the index type is `unsigned char`, and the npos value will be interpreted by LLDB as `255` when it should be `-1`.

This change does not special case the variant optimization; it just reads the type instead of assuming it's `unsigned int`.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D138892
2022-11-30 13:20:13 -08:00
..
generic Revert "[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer" 2022-11-25 12:32:33 -08:00
libcxx [DataFormatter] Fix variant npos with `_LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION` enabled. 2022-11-30 13:20:13 -08:00
libstdcpp [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00