diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:03:47 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:04:23 +0000 |
| commit | 7fa27ce4a07f19b07799a767fc29416f3b625afb (patch) | |
| tree | 27825c83636c4de341eb09a74f49f5d38a15d165 /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | |
| parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) | |
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
| -rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 365d499bead8..012f16e95e77 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/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> { |
