Skip to content

Commit 2fc0e2c

Browse files
authored
[lldb][NativePDB] Sort function name and type basename maps deterministically. (#156530)
#153160 created those function maps and uses default sort comparator which is not deterministic when there are multiple entries with same name because llvm::sort is unstable sort. This fixes it by comparing the id value when tie happens and sort `m_type_base_names` deterministically as well.
1 parent 023a98c commit 2fc0e2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,11 +1735,11 @@ void SymbolFileNativePDB::CacheFunctionNames() {
17351735
}
17361736

17371737
// Sort them before value searching is working properly.
1738-
m_func_full_names.Sort();
1738+
m_func_full_names.Sort(std::less<uint32_t>());
17391739
m_func_full_names.SizeToFit();
1740-
m_func_method_names.Sort();
1740+
m_func_method_names.Sort(std::less<uint32_t>());
17411741
m_func_method_names.SizeToFit();
1742-
m_func_base_names.Sort();
1742+
m_func_base_names.Sort(std::less<uint32_t>());
17431743
m_func_base_names.SizeToFit();
17441744
}
17451745

@@ -2426,7 +2426,7 @@ void SymbolFileNativePDB::BuildParentMap() {
24262426

24272427
// After calling Append(), the type-name map needs to be sorted again to be
24282428
// able to look up a type by its name.
2429-
m_type_base_names.Sort();
2429+
m_type_base_names.Sort(std::less<uint32_t>());
24302430

24312431
// Now that we know the forward -> full mapping of all type indices, we can
24322432
// re-write all the indices. At the end of this process, we want a mapping

0 commit comments

Comments
 (0)