From 77ee4b4c9be515bd27dee99f5a30bb36002fd702 Mon Sep 17 00:00:00 2001 From: Sterling Augustine Date: Mon, 13 Jul 2020 17:19:01 -0700 Subject: [PATCH] Desugar class type for iterator lookup. Summary: Without this, printing sets and maps hidden behind using declarations fail. Reviewers: #libc! Subscribers: libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D83732 --- libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp | 4 ++++ libcxx/utils/gdb/libcxx/printers.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp b/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp index 081e778540a0..540db56478e4 100644 --- a/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp +++ b/libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp @@ -383,6 +383,10 @@ void set_test() { ComparePrettyPrintToChars(prime_pairs, "std::set with 2 elements = {" "{first = 3, second = 5}, {first = 5, second = 7}}"); + + using using_set = std::set; + using_set other{1, 2, 3}; + ComparePrettyPrintToChars(other, "std::set with 3 elements = {1, 2, 3}"); } void stack_test() { diff --git a/libcxx/utils/gdb/libcxx/printers.py b/libcxx/utils/gdb/libcxx/printers.py index 7cccc07997b3..0ee446f46c51 100644 --- a/libcxx/utils/gdb/libcxx/printers.py +++ b/libcxx/utils/gdb/libcxx/printers.py @@ -698,7 +698,7 @@ class StdMapPrinter(AbstractRBTreePrinter): def _init_cast_type(self, val_type): map_it_type = gdb.lookup_type( - str(val_type) + "::iterator").strip_typedefs() + str(val_type.strip_typedefs()) + "::iterator").strip_typedefs() tree_it_type = map_it_type.template_argument(0) node_ptr_type = tree_it_type.template_argument(1) return node_ptr_type @@ -717,7 +717,7 @@ class StdSetPrinter(AbstractRBTreePrinter): def _init_cast_type(self, val_type): set_it_type = gdb.lookup_type( - str(val_type) + "::iterator").strip_typedefs() + str(val_type.strip_typedefs()) + "::iterator").strip_typedefs() node_ptr_type = set_it_type.template_argument(1) return node_ptr_type