This is an archive of the discontinued LLVM Phabricator instance.

Remove `friend` classes from TypeCategoryMap
ClosedPublic

Authored by jgorbe on May 20 2022, 4:15 PM.

Details

Summary

As far as I can tell, the only thing those friend classes access is the
ValueSP typedef.

Given that this is a map-ish class, with "Map" in its name, it doesn't seem like
a stretch to make KeyType, ValueType and ValueSP public. More so when the
public methods of the class have KeyType and ValueSP arguments and clearly
ValueSP needs to be accessed from the outside.

friend complicates local reasoning about who can access private members, which
is valuable in a class like this that has every method locking a mutex to
prevent concurrent access.

Diff Detail

Event Timeline

jgorbe created this revision.May 20 2022, 4:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2022, 4:15 PM
jgorbe requested review of this revision.May 20 2022, 4:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2022, 4:15 PM
This revision is now accepted and ready to land.May 20 2022, 5:48 PM
This revision was automatically updated to reflect the committed changes.