[libcxx-commits] [libcxx] 77ee4b4 - Desugar class type for iterator lookup.

Sterling Augustine via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 14 11:37:52 PDT 2020


Author: Sterling Augustine
Date: 2020-07-14T11:37:03-07:00
New Revision: 77ee4b4c9be515bd27dee99f5a30bb36002fd702

URL: https://github.com/llvm/llvm-project/commit/77ee4b4c9be515bd27dee99f5a30bb36002fd702
DIFF: https://github.com/llvm/llvm-project/commit/77ee4b4c9be515bd27dee99f5a30bb36002fd702.diff

LOG: 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

Added: 
    

Modified: 
    libcxx/test/pretty_printers/gdb_pretty_printer_test.sh.cpp
    libcxx/utils/gdb/libcxx/printers.py

Removed: 
    


################################################################################
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<int>;
+  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
 


        


More information about the libcxx-commits mailing list