[PATCH] Define pretty printers for C++17 library components

Jonathan Wakely jwakely@redhat.com
Mon Sep 19 15:58:00 GMT 2016


On 17/09/16 16:20 +0100, Jonathan Wakely wrote:
>This tweaks the existing printers for Fundamentals TS components to
>work for the C++17 versions, and adds a printer for std::variant.
>
>	* python/libstdcxx/v6/printers.py (StdVariantPrinter): Define.
>	(StdExpAnyPrinter, StdExpOptionalPrinter, StdExpStringViewPrinter):
>	Register for C++17 components in namespace std. Strip inline namespace
>	from typename.

This improves the output for the std::variant printer and adds type
printers and tests for the C++17 types.

I am inclined to change the printers for any and optional so they also
use a display_hint of 'array', which means they would show:

  std::optional<Foo> = {val}

instead of 

  std::optional<Foo> = {[contained value] = val}

IIRC I only made them show the "[contained value]" part because I
couldn't figure out how to do {val}.

We might also want to consider using 'array' for std::set, because
currently it shows fake indices for the elements, e.g.

  {[0] = x, [1] = y, [2] z}

but that would be better shown as {x, y, z}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 9474 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160919/4b4fc85f/attachment.bin>


More information about the Libstdc++ mailing list