[all-commits] [llvm/llvm-project] ea9ff9: [LLDB][formatters] Add formatter for libc++'s std:...
Adrian Prantl via All-commits
all-commits at lists.llvm.org
Mon Jun 13 12:59:54 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ea9ff9fac3a6ea77b488081dd9faabc8fe334b46
https://github.com/llvm/llvm-project/commit/ea9ff9fac3a6ea77b488081dd9faabc8fe334b46
Author: Adrian Prantl <aprantl at apple.com>
Date: 2022-06-13 (Mon, 13 Jun 2022)
Changed paths:
M lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
M lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
A lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
A lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/Makefile
A lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/TestDataFormatterLibcxxSpan.py
A lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/main.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list