[Lldb-commits] [lldb] r306391 - Move Connection and IOObject interfaces to Utility module

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 27 03:33:15 PDT 2017


Author: labath
Date: Tue Jun 27 03:33:14 2017
New Revision: 306391

URL: http://llvm.org/viewvc/llvm-project?rev=306391&view=rev
Log:
Move Connection and IOObject interfaces to Utility module

Summary:
These interfaces have no dependencies, so it makes sense for them to be
in the lowest level modules, to make sure that other parts of the
codebase can use them without introducing loops.

The only exception here is the Connection::CreateDefaultConnection
method, which I've moved to Host, as it instantiates concrete
implementations, and that's where the implementations live.

Reviewers: jingham, zturner

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34400

Added:
    lldb/trunk/include/lldb/Utility/Connection.h
      - copied, changed from r306278, lldb/trunk/include/lldb/Core/Connection.h
    lldb/trunk/include/lldb/Utility/IOObject.h
      - copied, changed from r306278, lldb/trunk/include/lldb/Host/IOObject.h
    lldb/trunk/source/Utility/Connection.cpp
      - copied, changed from r306278, lldb/trunk/source/Host/common/IOObject.cpp
    lldb/trunk/source/Utility/IOObject.cpp
      - copied, changed from r306278, lldb/trunk/source/Host/common/IOObject.cpp
Removed:
    lldb/trunk/include/lldb/Core/Connection.h
    lldb/trunk/include/lldb/Host/IOObject.h
    lldb/trunk/source/Core/Connection.cpp
    lldb/trunk/source/Host/common/IOObject.cpp
Modified:
    lldb/trunk/include/lldb/Host/File.h
    lldb/trunk/include/lldb/Host/Host.h
    lldb/trunk/include/lldb/Host/MainLoopBase.h
    lldb/trunk/include/lldb/Host/Socket.h
    lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
    lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
    lldb/trunk/source/API/SBCommunication.cpp
    lldb/trunk/source/Core/CMakeLists.txt
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Host/CMakeLists.txt
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
    lldb/trunk/source/Utility/CMakeLists.txt
    lldb/trunk/tools/lldb-server/Acceptor.h

Removed: lldb/trunk/include/lldb/Core/Connection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Connection.h?rev=306390&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/Connection.h (original)
+++ lldb/trunk/include/lldb/Core/Connection.h (removed)
@@ -1,214 +0,0 @@
-//===-- Connection.h --------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Connection_h_
-#define liblldb_Connection_h_
-
-#include "lldb/lldb-defines.h"      // for DISALLOW_COPY_AND_ASSIGN
-#include "lldb/lldb-enumerations.h" // for ConnectionStatus
-#include "lldb/lldb-forward.h"      // for IOObjectSP
-
-#include "llvm/ADT/StringRef.h" // for StringRef
-
-#include <ratio> // for micro
-#include <string>
-
-#include <stddef.h> // for size_t
-
-namespace lldb_private {
-class Status;
-}
-namespace lldb_private {
-template <typename Ratio> class Timeout;
-}
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class Connection Connection.h "lldb/Core/Connection.h"
-/// @brief A communication connection class.
-///
-/// A class that implements that actual communication functions for
-/// connecting/disconnecting, reading/writing, and waiting for bytes
-/// to become available from a two way communication connection.
-///
-/// This class is designed to only do very simple communication
-/// functions. Instances can be instantiated and given to a
-/// Communication class to perform communications where clients can
-/// listen for broadcasts, and perform other higher level communications.
-//----------------------------------------------------------------------
-class Connection {
-public:
-  //------------------------------------------------------------------
-  /// Default constructor
-  //------------------------------------------------------------------
-  Connection();
-
-  //------------------------------------------------------------------
-  /// Virtual destructor since this class gets subclassed and handed
-  /// to a Communication object.
-  //------------------------------------------------------------------
-  virtual ~Connection();
-
-  static Connection *CreateDefaultConnection(const char *url);
-
-  //------------------------------------------------------------------
-  /// Connect using the connect string \a url.
-  ///
-  /// @param[in] url
-  ///     A string that contains all information needed by the
-  ///     subclass to connect to another client.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns false. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     \b True if the connect succeeded, \b false otherwise. The
-  ///     internal error object should be filled in with an
-  ///     appropriate value based on the result of this function.
-  ///
-  /// @see Status& Communication::GetError ();
-  //------------------------------------------------------------------
-  virtual lldb::ConnectionStatus Connect(llvm::StringRef url,
-                                         Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Disconnect the communications connection if one is currently
-  /// connected.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns false. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     \b True if the disconnect succeeded, \b false otherwise. The
-  ///     internal error object should be filled in with an
-  ///     appropriate value based on the result of this function.
-  ///
-  /// @see Status& Communication::GetError ();
-  //------------------------------------------------------------------
-  virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Check if the connection is valid.
-  ///
-  /// @return
-  ///     \b True if this object is currently connected, \b false
-  ///     otherwise.
-  //------------------------------------------------------------------
-  virtual bool IsConnected() const = 0;
-
-  //------------------------------------------------------------------
-  /// The read function that attempts to read from the connection.
-  ///
-  /// @param[in] dst
-  ///     A destination buffer that must be at least \a dst_len bytes
-  ///     long.
-  ///
-  /// @param[in] dst_len
-  ///     The number of bytes to attempt to read, and also the max
-  ///     number of bytes that can be placed into \a dst.
-  ///
-  /// @param[in] timeout
-  ///     The number of microseconds to wait for the data.
-  ///
-  /// @param[out] status
-  ///     On return, indicates whether the call was successful or terminated
-  ///     due to some error condition.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns zero. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     The number of bytes actually read.
-  ///
-  /// @see size_t Communication::Read (void *, size_t, uint32_t);
-  //------------------------------------------------------------------
-  virtual size_t Read(void *dst, size_t dst_len,
-                      const Timeout<std::micro> &timeout,
-                      lldb::ConnectionStatus &status, Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// The actual write function that attempts to write to the
-  /// communications protocol.
-  ///
-  /// Subclasses must override this function.
-  ///
-  /// @param[in] dst
-  ///     A desination buffer that must be at least \a dst_len bytes
-  ///     long.
-  ///
-  /// @param[in] dst_len
-  ///     The number of bytes to attempt to write, and also the
-  ///     number of bytes are currently available in \a dst.
-  ///
-  /// @param[out] error_ptr
-  ///     A pointer to an error object that should be given an
-  ///     appropriate error value if this method returns zero. This
-  ///     value can be NULL if the error value should be ignored.
-  ///
-  /// @return
-  ///     The number of bytes actually Written.
-  //------------------------------------------------------------------
-  virtual size_t Write(const void *dst, size_t dst_len,
-                       lldb::ConnectionStatus &status, Status *error_ptr) = 0;
-
-  //------------------------------------------------------------------
-  /// Returns a URI that describes this connection object
-  ///
-  /// Subclasses may override this function.
-  ///
-  /// @return
-  ///     Returns URI or an empty string if disconnecteds
-  //------------------------------------------------------------------
-  virtual std::string GetURI() = 0;
-
-  //------------------------------------------------------------------
-  /// Interrupts an ongoing Read() operation.
-  ///
-  /// If there is an ongoing read operation in another thread, this operation
-  /// return with status == eConnectionStatusInterrupted. Note that if there
-  /// data waiting to be read and an interrupt request is issued, the Read()
-  /// function will return the data immediately without processing the
-  /// interrupt request (which will remain queued for the next Read()
-  /// operation).
-  ///
-  /// @return
-  ///     Returns true is the interrupt request was successful.
-  //------------------------------------------------------------------
-  virtual bool InterruptRead() = 0;
-
-  //------------------------------------------------------------------
-  /// Returns the underlying IOObject used by the Connection.
-  ///
-  /// The IOObject can be used to wait for data to become available
-  /// on the connection. If the Connection does not use IOObjects (and
-  /// hence does not support waiting) this function should return a
-  /// null pointer.
-  ///
-  /// @return
-  ///     The underlying IOObject used for reading.
-  //------------------------------------------------------------------
-  virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
-
-private:
-  //------------------------------------------------------------------
-  // For Connection only
-  //------------------------------------------------------------------
-  DISALLOW_COPY_AND_ASSIGN(Connection);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_Connection_h_

Modified: lldb/trunk/include/lldb/Host/File.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Tue Jun 27 03:33:14 2017
@@ -10,8 +10,8 @@
 #ifndef liblldb_File_h_
 #define liblldb_File_h_
 
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private.h"
 

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Tue Jun 27 03:33:14 2017
@@ -238,6 +238,9 @@ public:
                                        uint32_t line_no);
 
   static size_t GetEnvironment(StringList &env);
+
+  static std::unique_ptr<Connection>
+  CreateDefaultConnection(llvm::StringRef url);
 };
 
 } // namespace lldb_private

Removed: lldb/trunk/include/lldb/Host/IOObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/IOObject.h?rev=306390&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/IOObject.h (original)
+++ lldb/trunk/include/lldb/Host/IOObject.h (removed)
@@ -1,56 +0,0 @@
-//===-- IOObject.h ----------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Host_Common_IOObject_h_
-#define liblldb_Host_Common_IOObject_h_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-class IOObject {
-public:
-  typedef enum {
-    eFDTypeFile,   // Other FD requiring read/write
-    eFDTypeSocket, // Socket requiring send/recv
-  } FDType;
-
-  // TODO: On Windows this should be a HANDLE, and wait should use
-  // WaitForMultipleObjects
-  typedef int WaitableHandle;
-  static const WaitableHandle kInvalidHandleValue;
-
-  IOObject(FDType type, bool should_close)
-      : m_fd_type(type), m_should_close_fd(should_close) {}
-  virtual ~IOObject() {}
-
-  virtual Status Read(void *buf, size_t &num_bytes) = 0;
-  virtual Status Write(const void *buf, size_t &num_bytes) = 0;
-  virtual bool IsValid() const = 0;
-  virtual Status Close() = 0;
-
-  FDType GetFdType() const { return m_fd_type; }
-
-  virtual WaitableHandle GetWaitableHandle() = 0;
-
-protected:
-  FDType m_fd_type;
-  bool m_should_close_fd; // True if this class should close the file descriptor
-                          // when it goes away.
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(IOObject);
-};
-}
-
-#endif

Modified: lldb/trunk/include/lldb/Host/MainLoopBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MainLoopBase.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/MainLoopBase.h (original)
+++ lldb/trunk/include/lldb/Host/MainLoopBase.h Tue Jun 27 03:33:14 2017
@@ -10,12 +10,10 @@
 #ifndef lldb_Host_posix_MainLoopBase_h_
 #define lldb_Host_posix_MainLoopBase_h_
 
-#include <functional>
-
-#include "llvm/Support/ErrorHandling.h"
-
-#include "lldb/Host/IOObject.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <functional>
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/Host/Socket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Socket.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Socket.h (original)
+++ lldb/trunk/include/lldb/Host/Socket.h Tue Jun 27 03:33:14 2017
@@ -15,9 +15,9 @@
 
 #include "lldb/lldb-private.h"
 
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/SocketAddress.h"
+#include "lldb/Utility/IOObject.h"
 #include "lldb/Utility/Status.h"
 
 #ifdef _WIN32

Modified: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h Tue Jun 27 03:33:14 2017
@@ -19,10 +19,10 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/Connection.h"
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/Predicate.h"
+#include "lldb/Utility/Connection.h"
+#include "lldb/Utility/IOObject.h"
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h Tue Jun 27 03:33:14 2017
@@ -10,7 +10,7 @@
 #ifndef liblldb_Host_windows_ConnectionGenericFileWindows_h_
 #define liblldb_Host_windows_ConnectionGenericFileWindows_h_
 
-#include "lldb/Core/Connection.h"
+#include "lldb/Host/Connection.h"
 #include "lldb/Host/windows/windows.h"
 #include "lldb/lldb-types.h"
 

Copied: lldb/trunk/include/lldb/Utility/Connection.h (from r306278, lldb/trunk/include/lldb/Core/Connection.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Connection.h?p2=lldb/trunk/include/lldb/Utility/Connection.h&p1=lldb/trunk/include/lldb/Core/Connection.h&r1=306278&r2=306391&rev=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Connection.h (original)
+++ lldb/trunk/include/lldb/Utility/Connection.h Tue Jun 27 03:33:14 2017
@@ -31,7 +31,7 @@ template <typename Ratio> class Timeout;
 namespace lldb_private {
 
 //----------------------------------------------------------------------
-/// @class Connection Connection.h "lldb/Core/Connection.h"
+/// @class Connection Connection.h "lldb/Utility/Connection.h"
 /// @brief A communication connection class.
 ///
 /// A class that implements that actual communication functions for
@@ -48,7 +48,7 @@ public:
   //------------------------------------------------------------------
   /// Default constructor
   //------------------------------------------------------------------
-  Connection();
+  Connection() = default;
 
   //------------------------------------------------------------------
   /// Virtual destructor since this class gets subclassed and handed
@@ -56,8 +56,6 @@ public:
   //------------------------------------------------------------------
   virtual ~Connection();
 
-  static Connection *CreateDefaultConnection(const char *url);
-
   //------------------------------------------------------------------
   /// Connect using the connect string \a url.
   ///

Copied: lldb/trunk/include/lldb/Utility/IOObject.h (from r306278, lldb/trunk/include/lldb/Host/IOObject.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/IOObject.h?p2=lldb/trunk/include/lldb/Utility/IOObject.h&p1=lldb/trunk/include/lldb/Host/IOObject.h&r1=306278&r2=306391&rev=306391&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/IOObject.h (original)
+++ lldb/trunk/include/lldb/Utility/IOObject.h Tue Jun 27 03:33:14 2017
@@ -32,7 +32,7 @@ public:
 
   IOObject(FDType type, bool should_close)
       : m_fd_type(type), m_should_close_fd(should_close) {}
-  virtual ~IOObject() {}
+  virtual ~IOObject();
 
   virtual Status Read(void *buf, size_t &num_bytes) = 0;
   virtual Status Write(const void *buf, size_t &num_bytes) = 0;
@@ -51,6 +51,6 @@ protected:
 private:
   DISALLOW_COPY_AND_ASSIGN(IOObject);
 };
-}
+} // namespace lldb_private
 
 #endif

Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Tue Jun 27 03:33:14 2017
@@ -11,6 +11,7 @@
 #include "lldb/API/SBBroadcaster.h"
 #include "lldb/Core/Communication.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Utility/Log.h"
 
 using namespace lldb;
@@ -51,7 +52,7 @@ void SBCommunication::SetCloseOnEOF(bool
 ConnectionStatus SBCommunication::Connect(const char *url) {
   if (m_opaque) {
     if (!m_opaque->HasConnection())
-      m_opaque->SetConnection(Connection::CreateDefaultConnection(url));
+      m_opaque->SetConnection(Host::CreateDefaultConnection(url).release());
     return m_opaque->Connect(url, NULL);
   }
   return eConnectionStatusNoConnection;

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Tue Jun 27 03:33:14 2017
@@ -7,7 +7,6 @@ add_lldb_library(lldbCore
   ArchSpec.cpp
   Broadcaster.cpp
   Communication.cpp
-  Connection.cpp
   Debugger.cpp
   Disassembler.cpp
   DumpDataExtractor.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Tue Jun 27 03:33:14 2017
@@ -9,11 +9,11 @@
 
 #include "lldb/Core/Communication.h"
 
-#include "lldb/Core/Connection.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Utility/Connection.h"
 #include "lldb/Utility/ConstString.h" // for ConstString
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Logging.h" // for LogIfAnyCategoriesSet, LIBLLDB...

Removed: lldb/trunk/source/Core/Connection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Connection.cpp?rev=306390&view=auto
==============================================================================
--- lldb/trunk/source/Core/Connection.cpp (original)
+++ lldb/trunk/source/Core/Connection.cpp (removed)
@@ -1,32 +0,0 @@
-//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/Connection.h"
-
-#if defined(_WIN32)
-#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
-#endif
-
-#include "lldb/Host/ConnectionFileDescriptor.h"
-
-#include <string.h> // for strstr
-
-using namespace lldb_private;
-
-Connection::Connection() {}
-
-Connection::~Connection() {}
-
-Connection *Connection::CreateDefaultConnection(const char *url) {
-#if defined(_WIN32)
-  if (strstr(url, "file://") == url)
-    return new ConnectionGenericFile();
-#endif
-  return new ConnectionFileDescriptor();
-}

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Jun 27 03:33:14 2017
@@ -13,7 +13,6 @@ add_host_subdirectory(common
   common/HostNativeThreadBase.cpp
   common/HostProcess.cpp
   common/HostThread.cpp
-  common/IOObject.cpp
   common/LockFileBase.cpp
   common/MainLoop.cpp
   common/MonitoringProcessLauncher.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Jun 27 03:33:14 2017
@@ -58,6 +58,7 @@
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Target/FileAction.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 #include "lldb/Target/UnixSignals.h"
@@ -73,6 +74,7 @@
 #include "llvm/Support/FileSystem.h"
 
 #if defined(_WIN32)
+#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
 #else
 #include "lldb/Host/posix/ProcessLauncherPosixFork.h"
@@ -624,6 +626,14 @@ const UnixSignalsSP &Host::GetUnixSignal
   return s_unix_signals_sp;
 }
 
+std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) {
+#if defined(_WIN32)
+  if (url.startswith("file://"))
+    return std::unique_ptr<Connection>(new ConnectionGenericFile());
+#endif
+  return std::unique_ptr<Connection>(new ConnectionFileDescriptor());
+}
+
 #if defined(LLVM_ON_UNIX)
 WaitStatus WaitStatus::Decode(int wstatus) {
   if (WIFEXITED(wstatus))

Removed: lldb/trunk/source/Host/common/IOObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/IOObject.cpp?rev=306390&view=auto
==============================================================================
--- lldb/trunk/source/Host/common/IOObject.cpp (original)
+++ lldb/trunk/source/Host/common/IOObject.cpp (removed)
@@ -1,14 +0,0 @@
-//===-- IOObject.cpp --------------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Host/IOObject.h"
-
-using namespace lldb_private;
-
-const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Tue Jun 27 03:33:14 2017
@@ -16,10 +16,10 @@
 
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Host/Config.h"
-#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Socket.h"
 #include "lldb/Host/SocketAddress.h"
 #include "lldb/Utility/SelectHelper.h"
+#include "lldb/Utility/Timeout.h"
 
 // C Includes
 #include <errno.h>
@@ -42,7 +42,6 @@
 #include "llvm/ADT/SmallVector.h"
 #endif
 // Project includes
-#include "lldb/Core/Communication.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Socket.h"

Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Tue Jun 27 03:33:14 2017
@@ -1,5 +1,6 @@
 add_lldb_library(lldbUtility
   Baton.cpp
+  Connection.cpp
   ConstString.cpp
   DataBufferHeap.cpp
   DataBufferLLVM.cpp
@@ -8,6 +9,7 @@ add_lldb_library(lldbUtility
   FastDemangle.cpp
   FileSpec.cpp
   History.cpp
+  IOObject.cpp
   JSON.cpp
   LLDBAssert.cpp
   Log.cpp

Copied: lldb/trunk/source/Utility/Connection.cpp (from r306278, lldb/trunk/source/Host/common/IOObject.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Connection.cpp?p2=lldb/trunk/source/Utility/Connection.cpp&p1=lldb/trunk/source/Host/common/IOObject.cpp&r1=306278&r2=306391&rev=306391&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/IOObject.cpp (original)
+++ lldb/trunk/source/Utility/Connection.cpp Tue Jun 27 03:33:14 2017
@@ -1,4 +1,4 @@
-//===-- IOObject.cpp --------------------------------------------*- C++ -*-===//
+//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Host/IOObject.h"
+#include "lldb/Utility/Connection.h"
 
 using namespace lldb_private;
 
-const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;
+Connection::~Connection() = default;

Copied: lldb/trunk/source/Utility/IOObject.cpp (from r306278, lldb/trunk/source/Host/common/IOObject.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/IOObject.cpp?p2=lldb/trunk/source/Utility/IOObject.cpp&p1=lldb/trunk/source/Host/common/IOObject.cpp&r1=306278&r2=306391&rev=306391&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/IOObject.cpp (original)
+++ lldb/trunk/source/Utility/IOObject.cpp Tue Jun 27 03:33:14 2017
@@ -7,8 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Host/IOObject.h"
+#include "lldb/Utility/IOObject.h"
 
 using namespace lldb_private;
 
 const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;
+IOObject::~IOObject() = default;

Modified: lldb/trunk/tools/lldb-server/Acceptor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/Acceptor.h?rev=306391&r1=306390&r2=306391&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/Acceptor.h (original)
+++ lldb/trunk/tools/lldb-server/Acceptor.h Tue Jun 27 03:33:14 2017
@@ -9,8 +9,8 @@
 #ifndef lldb_server_Acceptor_h_
 #define lldb_server_Acceptor_h_
 
-#include "lldb/Core/Connection.h"
 #include "lldb/Host/Socket.h"
+#include "lldb/Utility/Connection.h"
 #include "lldb/Utility/Status.h"
 
 #include <functional>




More information about the lldb-commits mailing list