diff options
Diffstat (limited to 'contrib/llvm-project/lldb/bindings/interface/SBType.i')
-rw-r--r-- | contrib/llvm-project/lldb/bindings/interface/SBType.i | 180 |
1 files changed, 98 insertions, 82 deletions
diff --git a/contrib/llvm-project/lldb/bindings/interface/SBType.i b/contrib/llvm-project/lldb/bindings/interface/SBType.i index 3cd82452084b..e7b3fd11e338 100644 --- a/contrib/llvm-project/lldb/bindings/interface/SBType.i +++ b/contrib/llvm-project/lldb/bindings/interface/SBType.i @@ -9,7 +9,7 @@ namespace lldb { %feature("docstring", -"Represents a member of a type in lldb.") SBTypeMember; +"Represents a member of a type.") SBTypeMember; class SBTypeMember { @@ -60,6 +60,9 @@ protected: std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap; }; +%feature("docstring", +"Represents a member function of a type." +) SBTypeMemberFunction; class SBTypeMemberFunction { public: @@ -111,72 +114,72 @@ protected: "Represents a data type in lldb. The FindFirstType() method of SBTarget/SBModule returns a SBType. -SBType supports the eq/ne operator. For example, - -main.cpp: - -class Task { -public: - int id; - Task *next; - Task(int i, Task *n): - id(i), - next(n) - {} -}; - -int main (int argc, char const *argv[]) -{ - Task *task_head = new Task(-1, NULL); - Task *task1 = new Task(1, NULL); - Task *task2 = new Task(2, NULL); - Task *task3 = new Task(3, NULL); // Orphaned. - Task *task4 = new Task(4, NULL); - Task *task5 = new Task(5, NULL); - - task_head->next = task1; - task1->next = task2; - task2->next = task4; - task4->next = task5; - - int total = 0; - Task *t = task_head; - while (t != NULL) { - if (t->id >= 0) - ++total; - t = t->next; +SBType supports the eq/ne operator. For example,:: + + //main.cpp: + + class Task { + public: + int id; + Task *next; + Task(int i, Task *n): + id(i), + next(n) + {} + }; + + int main (int argc, char const *argv[]) + { + Task *task_head = new Task(-1, NULL); + Task *task1 = new Task(1, NULL); + Task *task2 = new Task(2, NULL); + Task *task3 = new Task(3, NULL); // Orphaned. + Task *task4 = new Task(4, NULL); + Task *task5 = new Task(5, NULL); + + task_head->next = task1; + task1->next = task2; + task2->next = task4; + task4->next = task5; + + int total = 0; + Task *t = task_head; + while (t != NULL) { + if (t->id >= 0) + ++total; + t = t->next; + } + printf('We have a total number of %d tasks\\n', total); + + // This corresponds to an empty task list. + Task *empty_task_head = new Task(-1, NULL); + + return 0; // Break at this line } - printf('We have a total number of %d tasks\\n', total); - - // This corresponds to an empty task list. - Task *empty_task_head = new Task(-1, NULL); - - return 0; // Break at this line -} -find_type.py: + # find_type.py: - # Get the type 'Task'. - task_type = target.FindFirstType('Task') - self.assertTrue(task_type) + # Get the type 'Task'. + task_type = target.FindFirstType('Task') + self.assertTrue(task_type) - # Get the variable 'task_head'. - frame0.FindVariable('task_head') - task_head_type = task_head.GetType() - self.assertTrue(task_head_type.IsPointerType()) + # Get the variable 'task_head'. + frame0.FindVariable('task_head') + task_head_type = task_head.GetType() + self.assertTrue(task_head_type.IsPointerType()) - # task_head_type is 'Task *'. - task_pointer_type = task_type.GetPointerType() - self.assertTrue(task_head_type == task_pointer_type) + # task_head_type is 'Task *'. + task_pointer_type = task_type.GetPointerType() + self.assertTrue(task_head_type == task_pointer_type) - # Get the child mmember 'id' from 'task_head'. - id = task_head.GetChildMemberWithName('id') - id_type = id.GetType() + # Get the child mmember 'id' from 'task_head'. + id = task_head.GetChildMemberWithName('id') + id_type = id.GetType() - # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h). - int_type = id_type.GetBasicType(lldb.eBasicTypeInt) - # id_type and int_type should be the same type! - self.assertTrue(id_type == int_type) + # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h). + int_type = id_type.GetBasicType(lldb.eBasicTypeInt) + # id_type and int_type should be the same type! + self.assertTrue(id_type == int_type) ...") SBType; class SBType @@ -220,6 +223,9 @@ public: bool IsAnonymousType (); + bool + IsScopedEnumerationType (); + lldb::SBType GetPointerType(); @@ -242,6 +248,9 @@ public: GetCanonicalType(); lldb::SBType + GetEnumerationIntegerType(); + + lldb::SBType GetArrayElementType (); lldb::SBType @@ -277,6 +286,9 @@ public: lldb::SBTypeEnumMemberList GetEnumMembers(); + lldb::SBModule + GetModule(); + const char* GetName(); @@ -330,6 +342,7 @@ public: return template_args return None + module = property(GetModule, None, doc='''A read only property that returns the module in which type is defined.''') name = property(GetName, None, doc='''A read only property that returns the name for this type as a string.''') size = property(GetByteSize, None, doc='''A read only property that returns size in bytes for this type as an integer.''') is_pointer = property(IsPointerType, None, doc='''A read only property that returns a boolean value that indicates if this type is a pointer type.''') @@ -421,35 +434,38 @@ public: }; %feature("docstring", -"Represents a list of SBTypes. The FindTypes() method of SBTarget/SBModule -returns a SBTypeList. +"Represents a list of :py:class:`SBType` s. -SBTypeList supports SBType iteration. For example, +The FindTypes() method of :py:class:`SBTarget`/:py:class:`SBModule` returns a SBTypeList. -main.cpp: +SBTypeList supports :py:class:`SBType` iteration. For example, -class Task { -public: - int id; - Task *next; - Task(int i, Task *n): - id(i), - next(n) - {} -}; +.. code-block:: cpp + + // main.cpp: + + class Task { + public: + int id; + Task *next; + Task(int i, Task *n): + id(i), + next(n) + {} + }; -... +.. code-block:: python -find_type.py: + # find_type.py: - # Get the type 'Task'. - type_list = target.FindTypes('Task') - self.assertTrue(len(type_list) == 1) - # To illustrate the SBType iteration. - for type in type_list: - # do something with type + # Get the type 'Task'. + type_list = target.FindTypes('Task') + self.assertTrue(len(type_list) == 1) + # To illustrate the SBType iteration. + for type in type_list: + # do something with type -...") SBTypeList; +") SBTypeList; class SBTypeList { public: |