This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFC] Don't let Process inherit from UserID
ClosedPublic

Authored by teemperor on Nov 18 2020, 4:47 AM.

Details

Summary

I noticed that Process is inheriting from UserID to store its PID value. This patch
replaces this with a dedicated field in the Process class. This is NFC, but has some
small effects on the code using Process:

  • GetID() now returns a lldb::pid_t like all other process code instead of lldb::user_id_t. Both are typedefs for uint64_t, so no change in behaviour.
  • The equality operators defined for UserID no longer accept Process instances.
  • Removes the inherited method Process::Clear() which didn't actually clear anything beside the PID value.

We maybe should also remove the getters/setters to S/GetPID or something like that. I can update all the code for that
in a follow-up NFC commit.

Diff Detail

Event Timeline

teemperor requested review of this revision.Nov 18 2020, 4:47 AM
teemperor created this revision.
labath accepted this revision.Nov 18 2020, 5:01 AM

Seems reasonable. I don't think that renaming to [GS]etP(rocess)ID is necessary, but I am not against it either.

lldb/include/lldb/Target/Process.h
2741

lldb::pid_t

This revision is now accepted and ready to land.Nov 18 2020, 5:01 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2020, 5:34 AM