diff mbox

Use consistent naming in libstdcxx/v6/xmethods.py

Message ID yjt2y4la98xf.fsf@ruffy.mtv.corp.google.com
State New
Headers show

Commit Message

Doug Evans April 29, 2015, 4:49 p.m. UTC
Hi.

This patch splits out from the patch for 65839 the consistent naming
suggested here.
https://gcc.gnu.org/ml/libstdc++/2015-04/msg00155.html

Regression tested on amd64-linux.

Ok to commit?

2015-04-29  Doug Evans  <dje@google.com>

	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.

Comments

Jonathan Wakely April 29, 2015, 6:12 p.m. UTC | #1
On 29/04/15 09:49 -0700, Doug Evans wrote:
>Hi.
>
>This patch splits out from the patch for 65839 the consistent naming
>suggested here.
>https://gcc.gnu.org/ml/libstdc++/2015-04/msg00155.html
>
>Regression tested on amd64-linux.
>
>Ok to commit?

Thanks for doing this, OK to commit.
diff mbox

Patch

Index: xmethods.py
===================================================================
--- xmethods.py	(revision 222551)
+++ xmethods.py	(working copy)
@@ -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.XMethodMatch
 # 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.XMethodMatch
 # 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.XMetho
         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.XMethodMatche
 # 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