diff options
| author | 2019-06-23 21:36:31 +0000 | |
|---|---|---|
| committer | 2019-06-23 21:36:31 +0000 | |
| commit | 23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch) | |
| tree | f7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/utils/gdb-scripts | |
| parent | sort previous; ok deraadt (diff) | |
| download | wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip | |
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/utils/gdb-scripts')
| -rw-r--r-- | gnu/llvm/utils/gdb-scripts/prettyprinters.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gnu/llvm/utils/gdb-scripts/prettyprinters.py b/gnu/llvm/utils/gdb-scripts/prettyprinters.py index 918411db42f..7ddc33acb20 100644 --- a/gnu/llvm/utils/gdb-scripts/prettyprinters.py +++ b/gnu/llvm/utils/gdb-scripts/prettyprinters.py @@ -1,12 +1,15 @@ +from __future__ import print_function +import sys + import gdb.printing class Iterator: def __iter__(self): return self - # Python 2 compatibility - def next(self): - return self.__next__() + if sys.version_info.major == 2: + def next(self): + return self.__next__() def children(self): return self @@ -68,7 +71,7 @@ class ArrayRefPrinter: def __iter__(self): return self - def next(self): + def __next__(self): if self.cur == self.end: raise StopIteration count = self.count @@ -77,13 +80,12 @@ class ArrayRefPrinter: self.cur = self.cur + 1 return '[%d]' % count, cur.dereference() - __next__ = next + if sys.version_info.major == 2: + next = __next__ def __init__(self, val): self.val = val - __next__ = next - def children(self): data = self.val['Data'] return self._iterator(data, data + self.val['Length']) @@ -167,7 +169,7 @@ class DenseMapPrinter: while self.cur != self.end and (is_equal(self.cur.dereference()['first'], empty) or is_equal(self.cur.dereference()['first'], tombstone)): self.cur = self.cur + 1 - def next(self): + def __next__(self): if self.cur == self.end: raise StopIteration cur = self.cur @@ -180,7 +182,8 @@ class DenseMapPrinter: self.first = False return 'x', v - __next__ = next + if sys.version_info.major == 2: + next = __next__ def __init__(self, val): self.val = val |
