@@ -158,10 +158,20 @@ def __init__(self, xml_file, decl_factory, config, *args):
158
158
self .__mangled_suffix = ' *INTERNAL* '
159
159
self .__mangled_suffix_len = len (self .__mangled_suffix )
160
160
161
- self .__name_attrs_to_skip = []
162
- self .__read_location = \
163
- lambda decl , attrs , to_skip : self .__read_location_bootstrap (
164
- self , decl , attrs , to_skip )
161
+ # These fields are generated by clang, and have no location.
162
+ # Just set an empty location for them.
163
+ # bug #19: gp_offset, fp_offset, overflow_arg_area, reg_save_area
164
+ # bug #32: isa, flags, str and length were added in llvm 3.9
165
+ self .__name_attrs_to_skip = [
166
+ "gp_offset" ,
167
+ "fp_offset" ,
168
+ "overflow_arg_area" ,
169
+ "reg_save_area" ,
170
+ "isa" ,
171
+ "flags" ,
172
+ "str" ,
173
+ "length" ,
174
+ ]
165
175
166
176
self .__xml_generator_from_xml_file = None
167
177
@@ -275,41 +285,8 @@ def endElement(self, name):
275
285
if name in self .deep_declarations :
276
286
self .__inst = None
277
287
278
- def __read_location_bootstrap (self , inst , decl , attrs , _ ):
279
- """ This function monkey patches the __read_location function to either
280
- __read_location_gccxml or __read_location_castxml depending on the
281
- xml generator in use
282
- """
283
-
284
- if self .__xml_generator_from_xml_file .is_castxml :
285
- # These fields are generated by clang, and have no location.
286
- # Just set an empty location for them. Gccxml does not have
287
- # this problem.
288
- # bug #19: gp_offset, fp_offset, overflow_arg_area, reg_save_area
289
- # bug #32: isa, flags, str and length were added in llvm 3.9
290
- inst .__name_attrs_to_skip = [
291
- "gp_offset" ,
292
- "fp_offset" ,
293
- "overflow_arg_area" ,
294
- "reg_save_area" ,
295
- "isa" ,
296
- "flags" ,
297
- "str" ,
298
- "length"
299
- ]
300
- inst .__read_location = inst .__read_location_castxml
301
- else :
302
- inst .__read_location = inst .__read_location_gccxml
303
- return inst .__read_location (decl , attrs , inst .__name_attrs_to_skip )
304
-
305
- @staticmethod
306
- def __read_location_gccxml (decl , attrs , _ ):
307
- decl .location = declarations .location_t (
308
- file_name = attrs [XML_AN_FILE ],
309
- line = int (attrs [XML_AN_LINE ]))
310
-
311
288
@staticmethod
312
- def __read_location_castxml (decl , attrs , to_skip ):
289
+ def __read_location (decl , attrs , to_skip ):
313
290
if "name" in attrs and attrs ["name" ] in to_skip :
314
291
decl .location = declarations .location_t ('' , - 1 )
315
292
else :
0 commit comments