xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBCompileUnitExtensions.i (revision 95eb4b873b6a8b527c5bd78d7191975dfca38998)
1 STRING_EXTENSION_OUTSIDE(SBCompileUnit)
2 
3 %extend lldb::SBCompileUnit {
4 #ifdef SWIGPYTHON
5     %pythoncode %{
6         # operator== is a free function, which swig does not handle, so we inject
7         # our own equality operator here
8         def __eq__(self, other):
9             return not self.__ne__(other)
10 
11         def __iter__(self):
12             '''Iterate over all line entries in a lldb.SBCompileUnit object.'''
13             return lldb_iter(self, 'GetNumLineEntries', 'GetLineEntryAtIndex')
14 
15         def __len__(self):
16             '''Return the number of line entries in a lldb.SBCompileUnit
17             object.'''
18             return self.GetNumLineEntries()
19 
20         file = property(GetFileSpec, None, doc='''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''')
21         num_line_entries = property(GetNumLineEntries, None, doc='''A read only property that returns the number of line entries in a compile unit as an integer.''')
22     %}
23 #endif
24 }
25