Skip to content

Commit 77ee4b4

Browse files
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
1 parent 0a90ffa commit 77ee4b4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ void set_test() {
383383
ComparePrettyPrintToChars(prime_pairs,
384384
"std::set with 2 elements = {"
385385
"{first = 3, second = 5}, {first = 5, second = 7}}");
386+
387+
using using_set = std::set<int>;
388+
using_set other{1, 2, 3};
389+
ComparePrettyPrintToChars(other, "std::set with 3 elements = {1, 2, 3}");
386390
}
387391

388392
void stack_test() {

libcxx/utils/gdb/libcxx/printers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ class StdMapPrinter(AbstractRBTreePrinter):
698698

699699
def _init_cast_type(self, val_type):
700700
map_it_type = gdb.lookup_type(
701-
str(val_type) + "::iterator").strip_typedefs()
701+
str(val_type.strip_typedefs()) + "::iterator").strip_typedefs()
702702
tree_it_type = map_it_type.template_argument(0)
703703
node_ptr_type = tree_it_type.template_argument(1)
704704
return node_ptr_type
@@ -717,7 +717,7 @@ class StdSetPrinter(AbstractRBTreePrinter):
717717

718718
def _init_cast_type(self, val_type):
719719
set_it_type = gdb.lookup_type(
720-
str(val_type) + "::iterator").strip_typedefs()
720+
str(val_type.strip_typedefs()) + "::iterator").strip_typedefs()
721721
node_ptr_type = set_it_type.template_argument(1)
722722
return node_ptr_type
723723

0 commit comments

Comments
 (0)