From b693b8792e23b2d9839db05cbd725fbb92789df6 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 29 Apr 2015 21:57:04 +0000 Subject: [PATCH] Use consistent naming for value type attributes. * python/libstdcxx/v6/xmethods.py (ArrayWorkerBase): Rename _valtype to _val_type. (ArraySizeWorker, ArrayEmptyWorker): Ditto. (ArrayFrontWorker, ArrayBackWorker): Ditto. (ArrayAtWorker, ArraySubscriptWorker): Ditto. (DequeWorkerBase): Rename elemtype to val_type. (ForwardListWorkerBase): Rename _elem_type to _val_type. (ForwardListFrontWorker): Ditto. And rename elem_address to val_address. (ForwardListMethodsMatcher): Rename elem_type to val_type. (VectorWorkerBase): Rename _elemtype to _val_type. From-SVN: r222596 --- libstdc++-v3/ChangeLog | 15 ++++++ libstdc++-v3/python/libstdcxx/v6/xmethods.py | 54 ++++++++++---------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8f06de185ad..ca9ca6af123 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2015-04-29 Doug Evans + + Use consistent naming for value type attributes. + * python/libstdcxx/v6/xmethods.py (ArrayWorkerBase): Rename _valtype + to _val_type. + (ArraySizeWorker, ArrayEmptyWorker): Ditto. + (ArrayFrontWorker, ArrayBackWorker): Ditto. + (ArrayAtWorker, ArraySubscriptWorker): Ditto. + (DequeWorkerBase): Rename elemtype to val_type. + (ForwardListWorkerBase): Rename _elem_type to _val_type. + (ForwardListFrontWorker): Ditto. And rename elem_address to + val_address. + (ForwardListMethodsMatcher): Rename elem_type to val_type. + (VectorWorkerBase): Rename _elemtype to _val_type. + 2015-04-29 Jonathan Wakely PR libstdc++/65760 diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 85e51ad1c24..e4e920a3e5c 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -29,17 +29,17 @@ class LibStdCxxXMethod(gdb.xmethod.XMethod): # Xmethods for std::array class ArrayWorkerBase(gdb.xmethod.XMethodWorker): - def __init__(self, valtype, size): - self._valtype = valtype + def __init__(self, val_type, size): + self._val_type = val_type self._size = size def null_value(self): nullptr = gdb.parse_and_eval('(void *) 0') - return nullptr.cast(self._valtype.pointer()).dereference() + return nullptr.cast(self._val_type.pointer()).dereference() class ArraySizeWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None @@ -48,8 +48,8 @@ class ArraySizeWorker(ArrayWorkerBase): return self._size class ArrayEmptyWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None @@ -58,8 +58,8 @@ class ArrayEmptyWorker(ArrayWorkerBase): return (int(self._size) == 0) class ArrayFrontWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None @@ -71,8 +71,8 @@ class ArrayFrontWorker(ArrayWorkerBase): return self.null_value() class ArrayBackWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return None @@ -84,8 +84,8 @@ class ArrayBackWorker(ArrayWorkerBase): return self.null_value() class ArrayAtWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return gdb.lookup_type('std::size_t') @@ -97,8 +97,8 @@ class ArrayAtWorker(ArrayWorkerBase): return obj['_M_elems'][index] class ArraySubscriptWorker(ArrayWorkerBase): - def __init__(self, valtype, size): - ArrayWorkerBase.__init__(self, valtype, size) + def __init__(self, val_type, size): + ArrayWorkerBase.__init__(self, val_type, size) def get_arg_types(self): return gdb.lookup_type('std::size_t') @@ -139,8 +139,8 @@ class ArrayMethodsMatcher(gdb.xmethod.XMethodMatcher): # Xmethods for std::deque class DequeWorkerBase(gdb.xmethod.XMethodWorker): - def __init__(self, elemtype): - self._bufsize = (512 / elemtype.sizeof) or 1 + def __init__(self, val_type): + self._bufsize = (512 / val_type.sizeof) or 1 def size(self, obj): first_node = obj['_M_impl']['_M_start']['_M_node'] @@ -232,8 +232,8 @@ class DequeMethodsMatcher(gdb.xmethod.XMethodMatcher): # Xmethods for std::forward_list class ForwardListWorkerBase(gdb.xmethod.XMethodMatcher): - def __init__(self, elem_type, node_type): - self._elem_type = elem_type + def __init__(self, val_type, node_type): + self._val_type = val_type self._node_type = node_type def get_arg_types(self): @@ -246,8 +246,8 @@ class ForwardListEmptyWorker(ForwardListWorkerBase): class ForwardListFrontWorker(ForwardListWorkerBase): def __call__(self, obj): node = obj['_M_impl']['_M_head']['_M_next'].cast(self._node_type) - elem_address = node['_M_storage']['_M_storage'].address - return elem_address.cast(self._elem_type.pointer()).dereference() + val_address = node['_M_storage']['_M_storage'].address + return val_address.cast(self._val_type.pointer()).dereference() class ForwardListMethodsMatcher(gdb.xmethod.XMethodMatcher): def __init__(self): @@ -265,9 +265,9 @@ class ForwardListMethodsMatcher(gdb.xmethod.XMethodMatcher): method = self._method_dict.get(method_name) if method is None or not method.enabled: return None - elem_type = class_type.template_argument(0) + val_type = class_type.template_argument(0) node_type = gdb.lookup_type(str(class_type) + '::_Node').pointer() - return method.worker_class(elem_type, node_type) + return method.worker_class(val_type, node_type) # Xmethods for std::list @@ -330,11 +330,11 @@ class ListMethodsMatcher(gdb.xmethod.XMethodMatcher): # Xmethods for std::vector class VectorWorkerBase(gdb.xmethod.XMethodWorker): - def __init__(self, elemtype): - self._elemtype = elemtype + def __init__(self, val_type): + self._val_type = val_type def size(self, obj): - if self._elemtype.code == gdb.TYPE_CODE_BOOL: + if self._val_type.code == gdb.TYPE_CODE_BOOL: start = obj['_M_impl']['_M_start']['_M_p'] finish = obj['_M_impl']['_M_finish']['_M_p'] finish_offset = obj['_M_impl']['_M_finish']['_M_offset'] @@ -344,7 +344,7 @@ class VectorWorkerBase(gdb.xmethod.XMethodWorker): return obj['_M_impl']['_M_finish'] - obj['_M_impl']['_M_start'] def get(self, obj, index): - if self._elemtype.code == gdb.TYPE_CODE_BOOL: + if self._val_type.code == gdb.TYPE_CODE_BOOL: start = obj['_M_impl']['_M_start']['_M_p'] bit_size = start.dereference().type.sizeof * 8 valp = start + index / bit_size -- 2.30.2