@@ -299,6 +299,10 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
299
299
case DW_TAG_inlined_subroutine:
300
300
case DW_TAG_subprogram:
301
301
if (has_address) {
302
+ // If we have a mangled name, then the DW_AT_name attribute is
303
+ // usually the method name without the class or any parameters
304
+ bool is_method = DWARFDIE (&unit, &die).IsMethod ();
305
+
302
306
if (name) {
303
307
bool is_objc_method = false ;
304
308
if (cu_language == eLanguageTypeObjC ||
@@ -326,10 +330,6 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
326
330
ref);
327
331
}
328
332
}
329
- // If we have a mangled name, then the DW_AT_name attribute is
330
- // usually the method name without the class or any parameters
331
- bool is_method = DWARFDIE (&unit, &die).IsMethod ();
332
-
333
333
if (is_method)
334
334
set.function_methods .Insert (ConstString (name), ref);
335
335
else
@@ -338,17 +338,26 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
338
338
if (!is_method && !mangled_cstr && !is_objc_method)
339
339
set.function_fullnames .Insert (ConstString (name), ref);
340
340
}
341
- if (mangled_cstr) {
341
+
342
+ auto insert_mangled = [&](NameToDIE &index_set) {
343
+ if (!mangled_cstr)
344
+ return ;
345
+
342
346
// Make sure our mangled name isn't the same string table entry as
343
347
// our name. If it starts with '_', then it is ok, else compare the
344
348
// string to make sure it isn't the same and we don't end up with
345
349
// duplicate entries
346
350
if (name && name != mangled_cstr &&
347
351
((mangled_cstr[0 ] == ' _' ) ||
348
352
(::strcmp (name, mangled_cstr) != 0 ))) {
349
- set. function_fullnames .Insert (ConstString (mangled_cstr), ref);
353
+ index_set .Insert (ConstString (mangled_cstr), ref);
350
354
}
351
- }
355
+ };
356
+
357
+ if (is_method)
358
+ insert_mangled (set.function_methods );
359
+
360
+ insert_mangled (set.function_fullnames );
352
361
}
353
362
break ;
354
363
0 commit comments