xref: /llvm-project/lldb/bindings/interface/SBCompileUnitExtensions.i (revision 6813ef37377e8d8fadf6efe01e1ed80cc53b9c86)
1662548c8SAlex Langford STRING_EXTENSION_OUTSIDE(SBCompileUnit)
2662548c8SAlex Langford 
3662548c8SAlex Langford %extend lldb::SBCompileUnit {
4662548c8SAlex Langford #ifdef SWIGPYTHON
5662548c8SAlex Langford     %pythoncode %{
6*6813ef37SMed Ismail Bennani         # operator== is a free function, which swig does not handle, so we inject
7*6813ef37SMed Ismail Bennani         # our own equality operator here
8*6813ef37SMed Ismail Bennani         def __eq__(self, other):
9*6813ef37SMed Ismail Bennani             return not self.__ne__(other)
10*6813ef37SMed Ismail Bennani 
11662548c8SAlex Langford         def __iter__(self):
12662548c8SAlex Langford             '''Iterate over all line entries in a lldb.SBCompileUnit object.'''
13662548c8SAlex Langford             return lldb_iter(self, 'GetNumLineEntries', 'GetLineEntryAtIndex')
14662548c8SAlex Langford 
15662548c8SAlex Langford         def __len__(self):
16662548c8SAlex Langford             '''Return the number of line entries in a lldb.SBCompileUnit
17662548c8SAlex Langford             object.'''
18662548c8SAlex Langford             return self.GetNumLineEntries()
19662548c8SAlex Langford 
20662548c8SAlex Langford         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.''')
21662548c8SAlex Langford         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.''')
22662548c8SAlex Langford     %}
23662548c8SAlex Langford #endif
24662548c8SAlex Langford }
25