106c3fb27SDimitry Andric STRING_EXTENSION_OUTSIDE(SBCompileUnit) 206c3fb27SDimitry Andric 306c3fb27SDimitry Andric %extend lldb::SBCompileUnit { 406c3fb27SDimitry Andric #ifdef SWIGPYTHON 506c3fb27SDimitry Andric %pythoncode %{ 6*5f757f3fSDimitry Andric # operator== is a free function, which swig does not handle, so we inject 7*5f757f3fSDimitry Andric # our own equality operator here 8*5f757f3fSDimitry Andric def __eq__(self, other): 9*5f757f3fSDimitry Andric return not self.__ne__(other) 10*5f757f3fSDimitry Andric 1106c3fb27SDimitry Andric def __iter__(self): 1206c3fb27SDimitry Andric '''Iterate over all line entries in a lldb.SBCompileUnit object.''' 1306c3fb27SDimitry Andric return lldb_iter(self, 'GetNumLineEntries', 'GetLineEntryAtIndex') 1406c3fb27SDimitry Andric 1506c3fb27SDimitry Andric def __len__(self): 1606c3fb27SDimitry Andric '''Return the number of line entries in a lldb.SBCompileUnit 1706c3fb27SDimitry Andric object.''' 1806c3fb27SDimitry Andric return self.GetNumLineEntries() 1906c3fb27SDimitry Andric 2006c3fb27SDimitry Andric 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.''') 2106c3fb27SDimitry Andric 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.''') 2206c3fb27SDimitry Andric %} 2306c3fb27SDimitry Andric #endif 2406c3fb27SDimitry Andric } 25