llvm-project/lldb/test/API/functionalities/data-formatter
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
..
array_typedef [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
boolreference [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
builtin-formats [lldb][AArch64] Enable int128 test 2022-07-15 13:35:48 +00:00
callback-matching [lldb] Make callback-based formatter matching available from the CLI. 2022-11-10 10:29:38 -08:00
compactvectors [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
cstring-utf8-summary [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-advanced [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-caching [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-categories [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-cpp [lldb] Start from end of previous substr when checking ordered substrs 2022-10-14 11:16:51 -07:00
data-formatter-disabling [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-enum-format [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-globals [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-named-summaries [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-objc [lldb] Remove prefer-dynamic-value test override 2022-08-22 15:46:03 -07:00
data-formatter-proper-plurals [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-ptr-to-array [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-python-synth [lldb] Skip check for conflicting filter/synth when adding a new regex. 2022-10-06 13:27:11 -07:00
data-formatter-script [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-skip-summary [lldb-tests] Remove libstdc++ requirement from test 2022-10-24 16:27:10 +00:00
data-formatter-smart-array [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-stl [DataFormatter] Fix variant npos with `_LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION` enabled. 2022-11-30 13:20:13 -08:00
data-formatter-synth Revert "[lldb] Fix member access in GetExpressionPath" 2022-10-20 15:21:59 -07:00
data-formatter-synthtype [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
data-formatter-synthval [LLDB] Remove __future__ imports from tests 2022-08-15 08:54:06 +00:00
dump_dynamic [LLDB] Remove __future__ imports from tests 2022-08-15 08:54:06 +00:00
format-propagation [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
frameformat_smallstruct [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
hexcaps [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
language_category_updates [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
nsarraysynth [lldb] Remove prefer-dynamic-value test override 2022-08-22 15:46:03 -07:00
nsdictionarysynth [lldb] Remove prefer-dynamic-value test override 2022-08-22 15:46:03 -07:00
nssetsynth [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
ostypeformatting [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
parray [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
poarray Force system C++ stdlib in test that forces system clang. 2022-09-12 16:47:46 -07:00
ptr_ref_typedef [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
pyobjsynthprovider [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
refpointer-recursion [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
setvaluefromcstring
stringprinter [lldb] Don't print *trailing* nuls in char arrays 2022-03-09 14:31:17 +01:00
summary-string-onfail [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
synthcapping [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
synthupdate [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
type_summary_list_arg [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
type_summary_list_script [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
typedef_array Recommit: Compress formatting of array type names (int [4] -> int[4]) 2021-10-21 11:34:43 -07:00
user-format-vs-summary [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
var-in-aggregate-misuse [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
varscript_formatting [lldb][tests] Automatically call compute_mydir (NFC) 2022-06-17 14:34:49 -07:00
vector-types [LLDB] Remove __future__ imports from tests 2022-08-15 08:54:06 +00:00
categories