diff options
author | emaste <emaste@FreeBSD.org> | 2014-03-19 13:11:35 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2014-03-19 13:11:35 +0000 |
commit | 958843c32b7a29741f2e45996b5b3e89f9e108b0 (patch) | |
tree | 95ae4ffabc848a86b94be3ad3cd42471cdb66b06 /contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp | |
parent | 2a9993c246f3a2463ccd6b8786781e5b97a35065 (diff) | |
download | FreeBSD-src-958843c32b7a29741f2e45996b5b3e89f9e108b0.zip FreeBSD-src-958843c32b7a29741f2e45996b5b3e89f9e108b0.tar.gz |
MFC r258054: Update LLDB to upstream r194122 snapshot
Inludes minor changes relative to upstream, for compatibility with
FreeBSD's in-tree LLVM 3.3:
- Reverted LLDB r191806, restoring use of previous API.
- Reverted part of LLDB r189317, restoring previous enum names.
- Work around missing LLVM r192504, using previous registerEHFrames API
(limited functionality).
- Removed PlatformWindows header include and init/terminate calls.
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp b/contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp index 2a1f348..da4e085 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/PythonDataObjects.cpp @@ -93,18 +93,22 @@ PythonObject::Str () //---------------------------------------------------------------------- PythonString::PythonString (PyObject *py_obj) : - PythonObject(py_obj) + PythonObject() { + Reset(py_obj); // Use "Reset()" to ensure that py_obj is a string } PythonString::PythonString (const PythonObject &object) : - PythonObject(object.GetPythonObject()) + PythonObject() { + Reset(object.GetPythonObject()); // Use "Reset()" to ensure that py_obj is a string } PythonString::PythonString (const lldb::ScriptInterpreterObjectSP &script_object_sp) : - PythonObject (script_object_sp) + PythonObject() { + if (script_object_sp) + Reset((PyObject *)script_object_sp->GetObject()); // Use "Reset()" to ensure that py_obj is a string } PythonString::PythonString (const char* string) : @@ -158,23 +162,28 @@ PythonString::SetString (const char* string) //---------------------------------------------------------------------- PythonInteger::PythonInteger (PyObject *py_obj) : - PythonObject(py_obj) + PythonObject() { + Reset(py_obj); // Use "Reset()" to ensure that py_obj is a integer type } PythonInteger::PythonInteger (const PythonObject &object) : - PythonObject(object.GetPythonObject()) + PythonObject() { + Reset(object.GetPythonObject()); // Use "Reset()" to ensure that py_obj is a integer type } PythonInteger::PythonInteger (const lldb::ScriptInterpreterObjectSP &script_object_sp) : - PythonObject (script_object_sp) + PythonObject() { + if (script_object_sp) + Reset((PyObject *)script_object_sp->GetObject()); // Use "Reset()" to ensure that py_obj is a string } PythonInteger::PythonInteger (int64_t value) : - PythonObject(PyInt_FromLong(value)) + PythonObject() { + SetInteger (value); } @@ -185,8 +194,11 @@ PythonInteger::~PythonInteger () bool PythonInteger::Reset (PyObject *py_obj) { - if (py_obj && PyInt_Check(py_obj)) - return PythonObject::Reset(py_obj); + if (py_obj) + { + if (PyInt_Check (py_obj) || PyLong_Check(py_obj)) + return PythonObject::Reset(py_obj); + } PythonObject::Reset(NULL); return py_obj == NULL; @@ -196,15 +208,19 @@ int64_t PythonInteger::GetInteger() { if (m_py_obj) - return PyInt_AsLong(m_py_obj); - else - return UINT64_MAX; + { + if (PyInt_Check(m_py_obj)) + return PyInt_AsLong(m_py_obj); + else if (PyLong_Check(m_py_obj)) + return PyLong_AsLongLong(m_py_obj); + } + return UINT64_MAX; } void PythonInteger::SetInteger (int64_t value) { - PythonObject::Reset(PyInt_FromLong(value)); + PythonObject::Reset(PyLong_FromLongLong(value)); } //---------------------------------------------------------------------- @@ -222,19 +238,23 @@ PythonList::PythonList (uint32_t count) : } PythonList::PythonList (PyObject *py_obj) : - PythonObject(py_obj) + PythonObject() { + Reset(py_obj); // Use "Reset()" to ensure that py_obj is a list } PythonList::PythonList (const PythonObject &object) : - PythonObject(object.GetPythonObject()) + PythonObject() { + Reset(object.GetPythonObject()); // Use "Reset()" to ensure that py_obj is a list } PythonList::PythonList (const lldb::ScriptInterpreterObjectSP &script_object_sp) : - PythonObject (script_object_sp) + PythonObject() { + if (script_object_sp) + Reset((PyObject *)script_object_sp->GetObject()); // Use "Reset()" to ensure that py_obj is a list } PythonList::~PythonList () @@ -293,17 +313,21 @@ PythonDictionary::PythonDictionary () : PythonDictionary::PythonDictionary (PyObject *py_obj) : PythonObject(py_obj) { + Reset(py_obj); // Use "Reset()" to ensure that py_obj is a dictionary } PythonDictionary::PythonDictionary (const PythonObject &object) : - PythonObject(object.GetPythonObject()) + PythonObject() { + Reset(object.GetPythonObject()); // Use "Reset()" to ensure that py_obj is a dictionary } PythonDictionary::PythonDictionary (const lldb::ScriptInterpreterObjectSP &script_object_sp) : - PythonObject (script_object_sp) + PythonObject () { + if (script_object_sp) + Reset((PyObject *)script_object_sp->GetObject()); // Use "Reset()" to ensure that py_obj is a dictionary } PythonDictionary::~PythonDictionary () |