This is an archive of the discontinued LLVM Phabricator instance.

Remove shared pointer from NativeProcessProtocol
ClosedPublic

Authored by labath on Jul 7 2017, 6:56 AM.

Details

Summary

The usage of shared_from_this forces us to separate construction and
initialization phases, because shared_from_this() is not available in
the constructor (or destructor). The shared semantics are not necessary,
as we always have a clear owner of the native process class
(GDBRemoteCommunicationServerLLDB object). Even if we need shared
semantics in the future (which I think we should strongly avoid),
reverting this will not be necessary -- the owners can still easily
store the native process object in a shared pointer if they really want
to -- this just prevents the knowledge of that from leaking into the
class implementation.

After this a NativeThread object will hold a reference to the parent
process (instead of a weak_ptr) -- having a process instance always
available allows us to simplify some logic in this class (some of it was
already simplified because we were asserting that the process is
available, but this makes it obvious).

Event Timeline

labath created this revision.Jul 7 2017, 6:56 AM
krytarowski edited edge metadata.Jul 10 2017, 7:15 AM

I have no particular opinion on it. If it builds and works, I'm fine with it.

This revision was automatically updated to reflect the committed changes.