[Lldb-commits] [lldb] r250304 - Minor cleanup on PythonDataObject constructors.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 09:59:44 PDT 2015


Author: zturner
Date: Wed Oct 14 11:59:44 2015
New Revision: 250304

URL: http://llvm.org/viewvc/llvm-project?rev=250304&view=rev
Log:
Minor cleanup on PythonDataObject constructors.

Added a constructor that takes list_size for `PythonList`.
Made all single-argument constructors explicit.
Re-ordered constructors to be consistent with other classes.

Modified:
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=250304&r1=250303&r2=250304&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Wed Oct 14 11:59:44 2015
@@ -378,6 +378,12 @@ PythonList::PythonList(PyInitialValue va
         Reset(PyRefType::Owned, PyList_New(0));
 }
 
+PythonList::PythonList(int list_size)
+    : PythonObject()
+{
+    Reset(PyRefType::Owned, PyList_New(list_size));
+}
+
 PythonList::PythonList(PyRefType type, PyObject *py_obj)
     : PythonObject()
 {

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h?rev=250304&r1=250303&r2=250304&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h Wed Oct 14 11:59:44 2015
@@ -215,10 +215,10 @@ class PythonString : public PythonObject
 {
 public:
     PythonString();
-    PythonString(PyRefType type, PyObject *o);
-    PythonString(const PythonString &object);
     explicit PythonString(llvm::StringRef string);
     explicit PythonString(const char *string);
+    PythonString(PyRefType type, PyObject *o);
+    PythonString(const PythonString &object);
     ~PythonString() override;
 
     static bool Check(PyObject *py_obj);
@@ -243,9 +243,9 @@ class PythonInteger : public PythonObjec
 {
 public:
     PythonInteger();
+    explicit PythonInteger(int64_t value);
     PythonInteger(PyRefType type, PyObject *o);
     PythonInteger(const PythonInteger &object);
-    explicit PythonInteger(int64_t value);
     ~PythonInteger() override;
 
     static bool Check(PyObject *py_obj);
@@ -266,7 +266,8 @@ public:
 class PythonList : public PythonObject
 {
 public:
-    PythonList(PyInitialValue value);
+    explicit PythonList(PyInitialValue value);
+    explicit PythonList(int list_size);
     PythonList(PyRefType type, PyObject *o);
     PythonList(const PythonList &list);
     ~PythonList() override;
@@ -292,7 +293,7 @@ public:
 class PythonDictionary : public PythonObject
 {
 public:
-    PythonDictionary(PyInitialValue value);
+    explicit PythonDictionary(PyInitialValue value);
     PythonDictionary(PyRefType type, PyObject *o);
     PythonDictionary(const PythonDictionary &dict);
     ~PythonDictionary() override;
@@ -313,6 +314,7 @@ public:
 
     StructuredData::DictionarySP CreateStructuredDictionary() const;
 };
+
 } // namespace lldb_private
 
 #endif  // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H




More information about the lldb-commits mailing list