Page MenuHomePhabricator

[lldb][NFC] Don't inherit from UserID in ValueObject

Authored by teemperor on Feb 22 2021, 9:34 AM.


Group Reviewers
Restricted Project
rGd77e3c6aec29: [lldb][NFC] Don't inherit from UserID in ValueObject

ValueObject inherits from UserID which is just a bad idea:

  • The inheritance gives ValueObject some member functions that are at best misleading (such as Clear() which doesn't clear any value beside id).
  • It allows passing ValueObject to the overloaded operators for UserID (such as == or << which won't actually compare or print anything in the ValueObject).
  • It exposes the SetID and Clear which both allow users to change the internal id value.

Similar to D91699 which did the same for Process

Diff Detail

Event Timeline

teemperor created this revision.Feb 22 2021, 9:34 AM
teemperor requested review of this revision.Feb 22 2021, 9:34 AM
JDevlieghere accepted this revision.Feb 22 2021, 2:45 PM
This revision is now accepted and ready to land.Feb 22 2021, 2:45 PM
shafik added a subscriber: shafik.Feb 22 2021, 2:54 PM
shafik added inline comments.

This makes more sense, ValueObject is not a UserID but contains one.

teemperor updated this revision to Diff 325708.Feb 23 2021, 1:14 AM
  • Rebased.
  • Add a GetID() call where we relied on the == overload before.
This revision was automatically updated to reflect the committed changes.