This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Don't iterate over a std::set<Type*> in SymbolFileDWARF::GetTypes to make it deterministic
ClosedPublic

Authored by teemperor on Mar 2 2020, 2:17 PM.

Details

Summary

Currently SymbolFileDWARF::TypeSet is a typedef to a std::set<Type *>.
In SymbolFileDWARF::GetTypes we iterate over a TypeSet variable when finding
types so that logic is non-deterministic as it depends on the actual pointer address values.

This patch changes the TypeSet to a llvm::UniqueVector which always iterates in
the order in which we inserted the types into the list.

Diff Detail

Event Timeline

teemperor created this revision.Mar 2 2020, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2020, 2:17 PM
JDevlieghere accepted this revision.Mar 2 2020, 2:41 PM
This revision is now accepted and ready to land.Mar 2 2020, 2:41 PM
teemperor planned changes to this revision.Mar 2 2020, 2:45 PM

Just realized that this should be llvm::SetVector not UniqueVector ...

teemperor updated this revision to Diff 247733.Mar 2 2020, 3:03 PM
  • Use SetVector instead.
  • Remove now unused include to <set>
This revision is now accepted and ready to land.Mar 2 2020, 3:03 PM
JDevlieghere accepted this revision.Mar 2 2020, 3:08 PM

Seems like a better fit indeed, because we don't need the sequential IDs.

This revision was automatically updated to reflect the committed changes.