summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h73
1 files changed, 71 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index beeea4ca6fa..22c86fd4c35 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -70,6 +70,8 @@ enum class PyObjectType
List,
String,
Module,
+ Callable,
+ Tuple,
File
};
@@ -203,7 +205,7 @@ public:
Str() const;
static PythonObject
- ResolveNameGlobal(llvm::StringRef name);
+ ResolveNameWithDictionary(llvm::StringRef name, PythonDictionary dict);
PythonObject
ResolveName(llvm::StringRef name) const;
@@ -295,6 +297,7 @@ public:
class PythonList : public PythonObject
{
public:
+ PythonList() {}
explicit PythonList(PyInitialValue value);
explicit PythonList(int list_size);
PythonList(PyRefType type, PyObject *o);
@@ -320,9 +323,39 @@ public:
StructuredData::ArraySP CreateStructuredArray() const;
};
+class PythonTuple : public PythonObject
+{
+public:
+ PythonTuple() {}
+ explicit PythonTuple(PyInitialValue value);
+ explicit PythonTuple(int tuple_size);
+ PythonTuple(PyRefType type, PyObject *o);
+ PythonTuple(const PythonTuple &tuple);
+ PythonTuple(std::initializer_list<PythonObject> objects);
+ PythonTuple(std::initializer_list<PyObject*> objects);
+
+ ~PythonTuple() override;
+
+ static bool Check(PyObject *py_obj);
+
+ // Bring in the no-argument base class version
+ using PythonObject::Reset;
+
+ void Reset(PyRefType type, PyObject *py_obj) override;
+
+ uint32_t GetSize() const;
+
+ PythonObject GetItemAtIndex(uint32_t index) const;
+
+ void SetItemAtIndex(uint32_t index, const PythonObject &object);
+
+ StructuredData::ArraySP CreateStructuredArray() const;
+};
+
class PythonDictionary : public PythonObject
{
public:
+ PythonDictionary() {}
explicit PythonDictionary(PyInitialValue value);
PythonDictionary(PyRefType type, PyObject *o);
PythonDictionary(const PythonDictionary &dict);
@@ -357,7 +390,14 @@ class PythonModule : public PythonObject
static bool Check(PyObject *py_obj);
- static PythonModule MainModule();
+ static PythonModule
+ BuiltinsModule();
+
+ static PythonModule
+ MainModule();
+
+ static PythonModule
+ AddModule(llvm::StringRef module);
// Bring in the no-argument base class version
using PythonObject::Reset;
@@ -367,6 +407,35 @@ class PythonModule : public PythonObject
PythonDictionary GetDictionary() const;
};
+class PythonCallable : public PythonObject
+{
+public:
+ PythonCallable();
+ PythonCallable(PyRefType type, PyObject *o);
+ PythonCallable(const PythonCallable &dict);
+
+ ~PythonCallable() override;
+
+ static bool
+ Check(PyObject *py_obj);
+
+ // Bring in the no-argument base class version
+ using PythonObject::Reset;
+
+ void
+ Reset(PyRefType type, PyObject *py_obj) override;
+
+ void
+ GetNumArguments(size_t &num_args, bool &has_varargs, bool &has_kwargs) const;
+
+ PythonObject
+ operator ()(std::initializer_list<PyObject*> args);
+
+ PythonObject
+ operator ()(std::initializer_list<PythonObject> args);
+};
+
+
class PythonFile : public PythonObject
{
public:
OpenPOWER on IntegriCloud