The Port type has stipuations that the same exact mask used to open it
needs to close it. This can currently be violated by calling its move
constructor to put it somewhere else. We still need the move constructor
to handle the open and closing functions. So, we simply make these
constructors private and only allow a few classes to have move
priviledges on it.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Let's put port.close in the destructor in the same commit as that's available branch-free for non-movable types. Also write a comment to the effect of "move only modulo optional" or similar as otherwise it's not obvious why the move ctors are not deleted.
I'm assuming that optional doesn't call the destructor on a value that isn't there but that's not a safe assumption. Let's go with this patch as-is and work out what to do with raii separately.
I tried implementing the destructor as an RAII interface, but it had some issues I didn't delve too far into at the time.
Diff is ok by me as currently written
libc/src/__support/RPC/rpc.h | ||
---|---|---|
261 | Guessing we can't have delete here while using an optional that requires move? |
libc/src/__support/RPC/rpc.h | ||
---|---|---|
261 | Yep, so next best thing is making it private. |
Guessing we can't have delete here while using an optional that requires move?