diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
-rw-r--r-- | contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 365d499bead8..012f16e95e77 100644 --- a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -201,6 +201,7 @@ template <> struct PythonFormat<short> : PassthroughFormat<short, 'h'> {}; template <> struct PythonFormat<unsigned short> : PassthroughFormat<unsigned short, 'H'> {}; template <> struct PythonFormat<int> : PassthroughFormat<int, 'i'> {}; +template <> struct PythonFormat<bool> : PassthroughFormat<bool, 'p'> {}; template <> struct PythonFormat<unsigned int> : PassthroughFormat<unsigned int, 'I'> {}; template <> struct PythonFormat<long> : PassthroughFormat<long, 'l'> {}; @@ -342,6 +343,15 @@ public: return python::Take<PythonObject>(obj); } + llvm::Expected<PythonObject> GetType() const { + if (!m_py_obj) + return nullDeref(); + PyObject *obj = PyObject_Type(m_py_obj); + if (!obj) + return exception(); + return python::Take<PythonObject>(obj); + } + llvm::Expected<bool> IsTrue() { if (!m_py_obj) return nullDeref(); @@ -353,7 +363,7 @@ public: llvm::Expected<long long> AsLongLong() const; - llvm::Expected<long long> AsUnsignedLongLong() const; + llvm::Expected<unsigned long long> AsUnsignedLongLong() const; // wraps on overflow, instead of raising an error. llvm::Expected<unsigned long long> AsModuloUnsignedLongLong() const; @@ -479,6 +489,10 @@ public: void SetInteger(int64_t value); StructuredData::IntegerSP CreateStructuredInteger() const; + + StructuredData::UnsignedIntegerSP CreateStructuredUnsignedInteger() const; + + StructuredData::SignedIntegerSP CreateStructuredSignedInteger() const; }; class PythonBoolean : public TypedPythonObject<PythonBoolean> { |