Skip to content

Commit 89b6584

Browse files
committedJul 2, 2019
[swig] Don't mess with swig internals.
As of SWIG 4.0, __swig_getmethods__ and __swig_setmethods__ are no longer defined. It appears that there's no need to mess with these internals, we can simplify define the corresponding properties inline. Originally I wanted to use the swig extension %attribute and %attributeref to define properties. However, I couldn't find a way to add documentation to these attributes. Since we already had the properties defined inline, we might as well keep them. Differential revision: https://reviews.llvm.org/D63530 llvm-svn: 364974
1 parent 54c7907 commit 89b6584

31 files changed

+287
-842
lines changed
 

‎lldb/scripts/interface/SBAddress.i

+10-31
Original file line numberDiff line numberDiff line change
@@ -162,37 +162,16 @@ public:
162162
'''Convert the address to an hex string'''
163163
return '0x%x' % int(self)
164164

165-
__swig_getmethods__["module"] = GetModule
166-
if _newclass: module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) that this address resides within.''')
167-
168-
__swig_getmethods__["compile_unit"] = GetCompileUnit
169-
if _newclass: compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) that this address resides within.''')
170-
171-
__swig_getmethods__["line_entry"] = GetLineEntry
172-
if _newclass: line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line entry (lldb.SBLineEntry) that this address resides within.''')
173-
174-
__swig_getmethods__["function"] = GetFunction
175-
if _newclass: function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) that this address resides within.''')
176-
177-
__swig_getmethods__["block"] = GetBlock
178-
if _newclass: block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the block (lldb.SBBlock) that this address resides within.''')
179-
180-
__swig_getmethods__["symbol"] = GetSymbol
181-
if _newclass: symbol = property(GetSymbol, None, doc='''A read only property that returns an lldb object that represents the symbol (lldb.SBSymbol) that this address resides within.''')
182-
183-
__swig_getmethods__["offset"] = GetOffset
184-
if _newclass: offset = property(GetOffset, None, doc='''A read only property that returns the section offset in bytes as an integer.''')
185-
186-
__swig_getmethods__["section"] = GetSection
187-
if _newclass: section = property(GetSection, None, doc='''A read only property that returns an lldb object that represents the section (lldb.SBSection) that this address resides within.''')
188-
189-
__swig_getmethods__["file_addr"] = GetFileAddress
190-
if _newclass: file_addr = property(GetFileAddress, None, doc='''A read only property that returns file address for the section as an integer. This is the address that represents the address as it is found in the object file that defines it.''')
191-
192-
__swig_getmethods__["load_addr"] = __get_load_addr_property__
193-
__swig_setmethods__["load_addr"] = __set_load_addr_property__
194-
if _newclass: load_addr = property(__get_load_addr_property__, __set_load_addr_property__, doc='''A read/write property that gets/sets the SBAddress using load address. The setter resolves SBAddress using the SBTarget from lldb.target so this property can ONLY be used in the interactive script interpreter (i.e. under the lldb script command) and not in Python based commands, or breakpoint commands.''')
195-
165+
module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) that this address resides within.''')
166+
compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) that this address resides within.''')
167+
line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line entry (lldb.SBLineEntry) that this address resides within.''')
168+
function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) that this address resides within.''')
169+
block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the block (lldb.SBBlock) that this address resides within.''')
170+
symbol = property(GetSymbol, None, doc='''A read only property that returns an lldb object that represents the symbol (lldb.SBSymbol) that this address resides within.''')
171+
offset = property(GetOffset, None, doc='''A read only property that returns the section offset in bytes as an integer.''')
172+
section = property(GetSection, None, doc='''A read only property that returns an lldb object that represents the section (lldb.SBSection) that this address resides within.''')
173+
file_addr = property(GetFileAddress, None, doc='''A read only property that returns file address for the section as an integer. This is the address that represents the address as it is found in the object file that defines it.''')
174+
load_addr = property(__get_load_addr_property__, __set_load_addr_property__, doc='''A read/write property that gets/sets the SBAddress using load address. The setter resolves SBAddress using the SBTarget from lldb.target so this property can ONLY be used in the interactive script interpreter (i.e. under the lldb script command) and not in Python based commands, or breakpoint commands.''')
196175
%}
197176

198177
};

‎lldb/scripts/interface/SBBlock.i

+9-26
Original file line numberDiff line numberDiff line change
@@ -143,32 +143,15 @@ public:
143143
def get_call_site(self):
144144
return declaration(self.GetInlinedCallSiteFile(), self.GetInlinedCallSiteLine(), self.GetInlinedCallSiteColumn())
145145

146-
__swig_getmethods__["parent"] = GetParent
147-
if _newclass: parent = property(GetParent, None, doc='''A read only property that returns the same result as GetParent().''')
148-
149-
__swig_getmethods__["first_child"] = GetFirstChild
150-
if _newclass: first_child = property(GetFirstChild, None, doc='''A read only property that returns the same result as GetFirstChild().''')
151-
152-
__swig_getmethods__["call_site"] = get_call_site
153-
if _newclass: call_site = property(get_call_site, None, doc='''A read only property that returns a lldb.declaration object that contains the inlined call site file, line and column.''')
154-
155-
__swig_getmethods__["sibling"] = GetSibling
156-
if _newclass: sibling = property(GetSibling, None, doc='''A read only property that returns the same result as GetSibling().''')
157-
158-
__swig_getmethods__["name"] = GetInlinedName
159-
if _newclass: name = property(GetInlinedName, None, doc='''A read only property that returns the same result as GetInlinedName().''')
160-
161-
__swig_getmethods__["inlined_block"] = GetContainingInlinedBlock
162-
if _newclass: inlined_block = property(GetContainingInlinedBlock, None, doc='''A read only property that returns the same result as GetContainingInlinedBlock().''')
163-
164-
__swig_getmethods__["range"] = get_ranges_access_object
165-
if _newclass: range = property(get_ranges_access_object, None, doc='''A read only property that allows item access to the address ranges for a block by integer (range = block.range[0]) and by lldb.SBAdddress (find the range that contains the specified lldb.SBAddress like "pc_range = lldb.frame.block.range[frame.addr]").''')
166-
167-
__swig_getmethods__["ranges"] = get_ranges_array
168-
if _newclass: ranges = property(get_ranges_array, None, doc='''A read only property that returns a list() object that contains all of the address ranges for the block.''')
169-
170-
__swig_getmethods__["num_ranges"] = GetNumRanges
171-
if _newclass: num_ranges = property(GetNumRanges, None, doc='''A read only property that returns the same result as GetNumRanges().''')
146+
parent = property(GetParent, None, doc='''A read only property that returns the same result as GetParent().''')
147+
first_child = property(GetFirstChild, None, doc='''A read only property that returns the same result as GetFirstChild().''')
148+
call_site = property(get_call_site, None, doc='''A read only property that returns a lldb.declaration object that contains the inlined call site file, line and column.''')
149+
sibling = property(GetSibling, None, doc='''A read only property that returns the same result as GetSibling().''')
150+
name = property(GetInlinedName, None, doc='''A read only property that returns the same result as GetInlinedName().''')
151+
inlined_block = property(GetContainingInlinedBlock, None, doc='''A read only property that returns the same result as GetContainingInlinedBlock().''')
152+
range = property(get_ranges_access_object, None, doc='''A read only property that allows item access to the address ranges for a block by integer (range = block.range[0]) and by lldb.SBAdddress (find the range that contains the specified lldb.SBAddress like "pc_range = lldb.frame.block.range[frame.addr]").''')
153+
ranges = property(get_ranges_array, None, doc='''A read only property that returns a list() object that contains all of the address ranges for the block.''')
154+
num_ranges = property(GetNumRanges, None, doc='''A read only property that returns the same result as GetNumRanges().''')
172155
%}
173156

174157
};

‎lldb/scripts/interface/SBBreakpoint.i

+6-20
Original file line numberDiff line numberDiff line change
@@ -286,26 +286,12 @@ public:
286286
object.'''
287287
return self.GetNumLocations()
288288

289-
__swig_getmethods__["locations"] = get_breakpoint_location_list
290-
if _newclass: locations = property(get_breakpoint_location_list, None, doc='''A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.''')
291-
292-
__swig_getmethods__["location"] = get_locations_access_object
293-
if _newclass: location = property(get_locations_access_object, None, doc='''A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).''')
294-
295-
__swig_getmethods__["id"] = GetID
296-
if _newclass: id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')
297-
298-
__swig_getmethods__["enabled"] = IsEnabled
299-
__swig_setmethods__["enabled"] = SetEnabled
300-
if _newclass: enabled = property(IsEnabled, SetEnabled, doc='''A read/write property that configures whether this breakpoint is enabled or not.''')
301-
302-
__swig_getmethods__["one_shot"] = IsOneShot
303-
__swig_setmethods__["one_shot"] = SetOneShot
304-
if _newclass: one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')
305-
306-
__swig_getmethods__["num_locations"] = GetNumLocations
307-
if _newclass: num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')
308-
289+
locations = property(get_breakpoint_location_list, None, doc='''A read only property that returns a list() of lldb.SBBreakpointLocation objects for this breakpoint.''')
290+
location = property(get_locations_access_object, None, doc='''A read only property that returns an object that can access locations by index (not location ID) (location = bkpt.location[12]).''')
291+
id = property(GetID, None, doc='''A read only property that returns the ID of this breakpoint.''')
292+
enabled = property(IsEnabled, SetEnabled, doc='''A read/write property that configures whether this breakpoint is enabled or not.''')
293+
one_shot = property(IsOneShot, SetOneShot, doc='''A read/write property that configures whether this breakpoint is one-shot (deleted when hit) or not.''')
294+
num_locations = property(GetNumLocations, None, doc='''A read only property that returns the count of locations of this breakpoint.''')
309295
%}
310296

311297

‎lldb/scripts/interface/SBCompileUnit.i

+2-5
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,8 @@ public:
126126
object.'''
127127
return self.GetNumLineEntries()
128128

129-
__swig_getmethods__["file"] = GetFileSpec
130-
if _newclass: 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.''')
131-
132-
__swig_getmethods__["num_line_entries"] = GetNumLineEntries
133-
if _newclass: 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.''')
129+
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.''')
130+
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.''')
134131
%}
135132
};
136133

0 commit comments

Comments
 (0)