diff options
author | Fangrui Song <maskray@google.com> | 2019-10-04 04:47:33 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-10-04 04:47:33 +0000 |
commit | 4a71328f1574e76fa45d6f3efe355fde999236a4 (patch) | |
tree | acea0f521965ed30173fd147d9850e7c1f99c59a /libcxx/utils | |
parent | ea31d1807c50a50e67533cdab794d0f2c7b046e2 (diff) | |
download | bcm5719-llvm-4a71328f1574e76fa45d6f3efe355fde999236a4.tar.gz bcm5719-llvm-4a71328f1574e76fa45d6f3efe355fde999236a4.zip |
Make libc++ gdb pretty printer Python 3 compatible
llvm-svn: 373691
Diffstat (limited to 'libcxx/utils')
-rw-r--r-- | libcxx/utils/gdb/libcxx/printers.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libcxx/utils/gdb/libcxx/printers.py b/libcxx/utils/gdb/libcxx/printers.py index ff45bde6172..b2d589424a3 100644 --- a/libcxx/utils/gdb/libcxx/printers.py +++ b/libcxx/utils/gdb/libcxx/printers.py @@ -137,13 +137,17 @@ class StdTuplePrinter(object): def __iter__(self): return self - def next(self): + def __next__(self): # child_iter raises StopIteration when appropriate. field_name = self.child_iter.next() child = self.val["__base_"][field_name]["__value_"] self.count += 1 return ("[%d]" % self.count, child) + # TODO Delete when we drop Python 2. + def next(self): + return self.__next__() + def __init__(self, val): self.val = val @@ -311,7 +315,7 @@ class StdVectorPrinter(object): def __iter__(self): return self - def next(self): + def __next__(self): """Retrieve the next element.""" self.count += 1 @@ -328,6 +332,10 @@ class StdVectorPrinter(object): self.offset = 0 return ("[%d]" % self.count, outbit) + # TODO Delete when we drop Python 2. + def next(self): + return self.__next__() + class _VectorIterator(object): """Class to iterate over the non-bool vector's children.""" @@ -339,7 +347,7 @@ class StdVectorPrinter(object): def __iter__(self): return self - def next(self): + def __next__(self): self.count += 1 if self.item == self.end: raise StopIteration @@ -347,6 +355,10 @@ class StdVectorPrinter(object): self.item += 1 return ("[%d]" % self.count, entry) + # TODO Delete when we drop Python 2. + def next(self): + return self.__next__() + def __init__(self, val): """Set val, length, capacity, and iterator for bool and normal vectors.""" self.val = val |