libstdc++: Add pretty printer for std::span
authorPhilipp Fent <fent@in.tum.de>
Thu, 14 Apr 2022 16:06:02 +0000 (17:06 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 19 Apr 2022 13:18:33 +0000 (14:18 +0100)
commitfdb3f82fb324c3ddd7464d11c8ea60a98f486a0e
treeca95582ee36253a4dbd38dc0fa0d3a255fdb9368
parent214d2860f4e1573f04ef57bfea59da0cc66883ce
libstdc++: Add pretty printer for std::span

This improves the debug output for C++20 spans.

Before:
{static extent = 18446744073709551615, _M_ptr = 0x7fffffffb9a8, _M_extent = {_M_extent_value = 2}}
Now with StdSpanPrinter:
std::span of length 2 = {1, 2}

Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (StdSpanPrinter): Define.
* testsuite/libstdc++-prettyprinters/cxx20.cc: Test it.
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx20.cc