diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-20 14:40:00 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-20 14:40:00 +0000 |
commit | c62683a796cbacc7acdde7303fc1e3e368beb8ae (patch) | |
tree | 9996e45f822dae9b5292fe3b9f5b4c355ab5683d /libstdc++-v3 | |
parent | 40ed993f7bc938cc120cbf910e49752d0e5f347e (diff) | |
download | gcc-c62683a796cbacc7acdde7303fc1e3e368beb8ae.tar.gz |
PR libstdc++/64695
* python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle new
tuple layout.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220871 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/python/libstdcxx/v6/printers.py | 29 |
2 files changed, 27 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 79a3bd75f24..fed16573f03 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2015-02-20 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/64695 + * python/libstdcxx/v6/printers.py (StdTuplePrinter): Handle new + tuple layout. + 2015-02-19 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/58357 diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 12631836eeb..5a414c59a7a 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -327,22 +327,35 @@ class StdTuplePrinter: return self def __next__ (self): - nodes = self.head.type.fields () # Check for further recursions in the inheritance tree. + # For a GCC 5+ tuple self.head is None after visiting all nodes: + if not self.head: + raise StopIteration + nodes = self.head.type.fields () + # For a GCC 4.x tuple there is a final node with no fields: if len (nodes) == 0: raise StopIteration # Check that this iteration has an expected structure. - if len (nodes) != 2: + if len (nodes) > 2: raise ValueError("Cannot parse more than 2 nodes in a tuple tree.") - # - Left node is the next recursion parent. - # - Right node is the actual class contained in the tuple. + if len (nodes) == 1: + # This is the last node of a GCC 5+ std::tuple. + impl = self.head.cast (nodes[0].type) + self.head = None + else: + # Either a node before the last node, or the last node of + # a GCC 4.x tuple (which has an empty parent). + + # - Left node is the next recursion parent. + # - Right node is the actual class contained in the tuple. - # Process right node. - impl = self.head.cast (nodes[1].type) + # Process right node. + impl = self.head.cast (nodes[1].type) + + # Process left node and set it as head. + self.head = self.head.cast (nodes[0].type) - # Process left node and set it as head. - self.head = self.head.cast (nodes[0].type) self.count = self.count + 1 # Finally, check the implementation. If it is |