[Lldb-commits] [lldb] r236320 - PosixPipes should not be copyable but should be movable.
Chaoren Lin
chaorenl at google.com
Fri May 1 09:49:24 PDT 2015
Author: chaoren
Date: Fri May 1 11:49:23 2015
New Revision: 236320
URL: http://llvm.org/viewvc/llvm-project?rev=236320&view=rev
Log:
PosixPipes should not be copyable but should be movable.
Summary: This addresses Oleksiy's comment in D9307.
Reviewers: clayborg, ovyalov
Reviewed By: clayborg, ovyalov
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9405
Modified:
lldb/trunk/include/lldb/Host/posix/PipePosix.h
lldb/trunk/source/Host/posix/PipePosix.cpp
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=236320&r1=236319&r2=236320&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Fri May 1 11:49:23 2015
@@ -29,6 +29,10 @@ public:
PipePosix();
PipePosix(int read_fd, int write_fd);
+ PipePosix(const PipePosix &) = delete;
+ PipePosix(PipePosix &&pipe_posix);
+ PipePosix &operator=(const PipePosix &) = delete;
+ PipePosix &operator=(PipePosix &&pipe_posix);
~PipePosix() override;
Modified: lldb/trunk/source/Host/posix/PipePosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/PipePosix.cpp?rev=236320&r1=236319&r2=236320&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/PipePosix.cpp (original)
+++ lldb/trunk/source/Host/posix/PipePosix.cpp Fri May 1 11:49:23 2015
@@ -129,11 +129,29 @@ SelectIO(int handle, bool is_read, const
}
PipePosix::PipePosix()
- : m_fds{PipePosix::kInvalidDescriptor, PipePosix::kInvalidDescriptor} {}
+ : m_fds{
+ PipePosix::kInvalidDescriptor,
+ PipePosix::kInvalidDescriptor
+ } {}
PipePosix::PipePosix(int read_fd, int write_fd)
: m_fds{read_fd, write_fd} {}
+PipePosix::PipePosix(PipePosix &&pipe_posix)
+ : PipeBase{std::move(pipe_posix)},
+ m_fds{
+ pipe_posix.ReleaseReadFileDescriptor(),
+ pipe_posix.ReleaseWriteFileDescriptor()
+ } {}
+
+PipePosix &PipePosix::operator=(PipePosix &&pipe_posix)
+{
+ PipeBase::operator=(std::move(pipe_posix));
+ m_fds[READ] = pipe_posix.ReleaseReadFileDescriptor();
+ m_fds[WRITE] = pipe_posix.ReleaseWriteFileDescriptor();
+ return *this;
+}
+
PipePosix::~PipePosix()
{
Close();
Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=236320&r1=236319&r2=236320&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Fri May 1 11:49:23 2015
@@ -319,7 +319,7 @@ JoinListenThread ()
}
Error
-WritePortToPipe(Pipe port_pipe, const uint16_t port)
+WritePortToPipe(Pipe &port_pipe, const uint16_t port)
{
char port_str[64];
const auto port_str_len = ::snprintf(port_str, sizeof(port_str), "%u", port);
More information about the lldb-commits
mailing list