diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2022-11-30 13:20:13 -0800 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2022-11-30 13:20:13 -0800 |
commit | 3c51ea3619e488db19cd26840ed46d58cfc7062f (patch) | |
tree | ae34f646207b4c42708679a3ce8276c41529b187 /llvm/lib/CodeGen/CodeGen.cpp | |
parent | ad6c8092dcb26b6991bab078e0e6cf1ab4836add (diff) | |
download | llvm-3c51ea3619e488db19cd26840ed46d58cfc7062f.zip llvm-3c51ea3619e488db19cd26840ed46d58cfc7062f.tar.gz llvm-3c51ea3619e488db19cd26840ed46d58cfc7062f.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions