diff options
author | Adrian Prantl <aprantl@apple.com> | 2022-06-13 10:51:01 -0700 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2022-06-13 12:59:38 -0700 |
commit | ea9ff9fac3a6ea77b488081dd9faabc8fe334b46 (patch) | |
tree | deafa3d022cd970a8d10c43e7c84f4fa64d1a496 /llvm/lib/Bitcode/Writer | |
parent | 53e31e273f7e9f8e284f54314f7fbcb89e4b78c0 (diff) | |
download | llvm-ea9ff9fac3a6ea77b488081dd9faabc8fe334b46.zip llvm-ea9ff9fac3a6ea77b488081dd9faabc8fe334b46.tar.gz llvm-ea9ff9fac3a6ea77b488081dd9faabc8fe334b46.tar.bz2 |
[LLDB][formatters] Add formatter for libc++'s std::span
This patch adds a libcxx formatter for std::span. The
implementation is based on the libcxx formatter for
std::vector. The main difference is the fact that
std::span conditionally has a __size member based
on whether it has a static or dynamic extent.
Example output of formatted span:
(std::span<const int, 18446744073709551615>) $0 = size=6 {
[0] = 0
[1] = 1
[2] = 2
[3] = 3
[4] = 4
[5] = 5
}
The second template parameter here is actually std::dynamic_extent,
but the type declaration we get back from the TypeSystemClang is the
actual value (which in this case is (size_t)-1). This is consistent
with diagnostics from clang, which doesn't desugar this value either.
E.g.,:
span.cpp:30:31: error: implicit instantiation of undefined template
'Undefined<std::span<int, 18446744073709551615>>'
Testing:
Added API-tests
Confirmed manually using LLDB cli that printing spans works in various scenarios
Patch by Michael Buch!
Differential Revision: https://reviews.llvm.org/D127481
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
0 files changed, 0 insertions, 0 deletions