Skip to content

Commit 4c87014

Browse files
committed
fixup! ManualDWARFIndex: add mangled names into methods index
1 parent bad5687 commit 4c87014

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
299299
case DW_TAG_inlined_subroutine:
300300
case DW_TAG_subprogram:
301301
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+
302306
if (name) {
303307
bool is_objc_method = false;
304308
if (cu_language == eLanguageTypeObjC ||
@@ -326,10 +330,6 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
326330
ref);
327331
}
328332
}
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-
333333
if (is_method)
334334
set.function_methods.Insert(ConstString(name), ref);
335335
else
@@ -338,17 +338,26 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
338338
if (!is_method && !mangled_cstr && !is_objc_method)
339339
set.function_fullnames.Insert(ConstString(name), ref);
340340
}
341-
if (mangled_cstr) {
341+
342+
auto insert_mangled = [&](NameToDIE &index_set) {
343+
if (!mangled_cstr)
344+
return;
345+
342346
// Make sure our mangled name isn't the same string table entry as
343347
// our name. If it starts with '_', then it is ok, else compare the
344348
// string to make sure it isn't the same and we don't end up with
345349
// duplicate entries
346350
if (name && name != mangled_cstr &&
347351
((mangled_cstr[0] == '_') ||
348352
(::strcmp(name, mangled_cstr) != 0))) {
349-
set.function_fullnames.Insert(ConstString(mangled_cstr), ref);
353+
index_set.Insert(ConstString(mangled_cstr), ref);
350354
}
351-
}
355+
};
356+
357+
if (is_method)
358+
insert_mangled(set.function_methods);
359+
360+
insert_mangled(set.function_fullnames);
352361
}
353362
break;
354363

0 commit comments

Comments
 (0)