labath created this revision.
labath added reviewers: jingham, zturner, teemperor.
Herald added a subscriber: mgorny.

This class was initially in Host because its implementation used to be
very OS-specific. However, with C++11, it has become a very simple
std::condition_variable wrapper, with no host-specific code.

It is also a general purpose utility class, so it makes sense for it to
live in a place where it can be used by everyone.

This has no effect on the layering right now, but it enables me to later
move the Listener+Broadcaster+Event combo to a lower layer, which is
important, as these are used in a lot of places (notably for launching a
process in Host code).


https://reviews.llvm.org/D50384

Files:
  include/lldb/Core/Event.h
  include/lldb/Core/IOHandler.h
  include/lldb/Host/Editline.h
  include/lldb/Host/Predicate.h
  include/lldb/Host/Socket.h
  include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
  include/lldb/Utility/Predicate.h
  source/Core/IOHandler.cpp
  source/Host/common/Host.cpp
  source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
  source/Plugins/Process/Windows/Common/DebuggerThread.cpp
  source/Plugins/Process/Windows/Common/DebuggerThread.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  unittests/Core/BroadcasterTest.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/PredicateTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/PredicateTest.cpp

Index: unittests/Utility/PredicateTest.cpp
===================================================================
--- unittests/Utility/PredicateTest.cpp
+++ unittests/Utility/PredicateTest.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Host/Predicate.h"
+#include "lldb/Utility/Predicate.h"
 #include "gtest/gtest.h"
 #include <thread>
 
Index: unittests/Utility/CMakeLists.txt
===================================================================
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -12,6 +12,7 @@
   JSONTest.cpp
   LogTest.cpp
   NameMatchesTest.cpp
+  PredicateTest.cpp
   RegisterValueTest.cpp
   StateTest.cpp
   StatusTest.cpp
Index: unittests/Host/CMakeLists.txt
===================================================================
--- unittests/Host/CMakeLists.txt
+++ unittests/Host/CMakeLists.txt
@@ -3,7 +3,6 @@
   HostInfoTest.cpp
   HostTest.cpp
   MainLoopTest.cpp
-  PredicateTest.cpp
   SocketAddressTest.cpp
   SocketTest.cpp
   SymbolsTest.cpp
Index: unittests/Core/BroadcasterTest.cpp
===================================================================
--- unittests/Core/BroadcasterTest.cpp
+++ unittests/Core/BroadcasterTest.cpp
@@ -12,7 +12,7 @@
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/Listener.h"
-#include "lldb/Host/Predicate.h"
+#include "lldb/Utility/Predicate.h"
 
 #include <thread>
 
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -23,8 +23,8 @@
 #include "lldb/Core/Communication.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/lldb-public.h"
 
 #include "lldb/Utility/StringExtractorGDBRemote.h"
Index: source/Plugins/Process/Windows/Common/DebuggerThread.h
===================================================================
--- source/Plugins/Process/Windows/Common/DebuggerThread.h
+++ source/Plugins/Process/Windows/Common/DebuggerThread.h
@@ -16,8 +16,8 @@
 #include "ForwardDecl.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/Predicate.h"
 
 namespace lldb_private {
 
Index: source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===================================================================
--- source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -12,15 +12,15 @@
 #include "IDebugDelegate.h"
 
 #include "lldb/Core/ModuleSpec.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/windows/HostProcessWindows.h"
 #include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ProcessLaunchInfo.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/Utility/Status.h"
 
 #include "Plugins/Process/Windows/Common/ProcessWindowsLog.h"
Index: source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
===================================================================
--- source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
+++ source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
@@ -21,7 +21,7 @@
 #include "lldb/Core/Communication.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Core/StreamBuffer.h"
-#include "lldb/Host/Predicate.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/lldb-private.h"
 
 class CommunicationKDP : public lldb_private::Communication {
Index: source/Host/common/Host.cpp
===================================================================
--- source/Host/common/Host.cpp
+++ source/Host/common/Host.cpp
@@ -52,7 +52,6 @@
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/MonitoringProcessLauncher.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
@@ -62,6 +61,7 @@
 #include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/lldb-private-forward.h"
 #include "llvm/ADT/SmallString.h"
Index: source/Core/IOHandler.cpp
===================================================================
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -26,7 +26,7 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Host/File.h"            // for File
-#include "lldb/Host/Predicate.h"       // for Predicate, ::eBroad...
+#include "lldb/Utility/Predicate.h"    // for Predicate, ::eBroad...
 #include "lldb/Utility/Status.h"       // for Status
 #include "lldb/Utility/StreamString.h" // for StreamString
 #include "lldb/Utility/StringList.h"   // for StringList
Index: include/lldb/Utility/Predicate.h
===================================================================
--- include/lldb/Utility/Predicate.h
+++ include/lldb/Utility/Predicate.h
@@ -34,11 +34,11 @@
   eBroadcastNever,   ///< No broadcast will be sent when the value is modified.
   eBroadcastAlways,  ///< Always send a broadcast when the value is modified.
   eBroadcastOnChange ///< Only broadcast if the value changes when the value is
-                     ///modified.
+                     /// modified.
 } PredicateBroadcastType;
 
 //----------------------------------------------------------------------
-/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
+/// @class Predicate Predicate.h "lldb/Utility/Predicate.h"
 /// A C++ wrapper class for providing threaded access to a value of
 /// type T.
 ///
@@ -220,8 +220,8 @@
   T m_value; ///< The templatized value T that we are protecting access to
   mutable std::mutex m_mutex; ///< The mutex to use when accessing the data
   std::condition_variable m_condition; ///< The pthread condition variable to
-                                       ///use for signaling that data available
-                                       ///or changed.
+                                       /// use for signaling that data available
+                                       /// or changed.
 
 private:
   //------------------------------------------------------------------
Index: include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
===================================================================
--- include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -20,9 +20,9 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Host/Pipe.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Utility/Connection.h"
 #include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Predicate.h"
 
 namespace lldb_private {
 
Index: include/lldb/Host/Socket.h
===================================================================
--- include/lldb/Host/Socket.h
+++ include/lldb/Host/Socket.h
@@ -15,9 +15,9 @@
 
 #include "lldb/lldb-private.h"
 
-#include "lldb/Host/Predicate.h"
 #include "lldb/Host/SocketAddress.h"
 #include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/Utility/Status.h"
 
 #ifdef _WIN32
Index: include/lldb/Host/Editline.h
===================================================================
--- include/lldb/Host/Editline.h
+++ include/lldb/Host/Editline.h
@@ -54,8 +54,8 @@
 #include <vector>
 
 #include "lldb/Host/ConnectionFileDescriptor.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Predicate.h"
 
 namespace lldb_private {
 namespace line_editor {
Index: include/lldb/Core/IOHandler.h
===================================================================
--- include/lldb/Core/IOHandler.h
+++ include/lldb/Core/IOHandler.h
@@ -11,9 +11,9 @@
 #define liblldb_IOHandler_h_
 
 #include "lldb/Core/ValueObjectList.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Flags.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-defines.h"  // for DISALLOW_COPY_AND_ASSIGN
Index: include/lldb/Core/Event.h
===================================================================
--- include/lldb/Core/Event.h
+++ include/lldb/Core/Event.h
@@ -11,8 +11,8 @@
 #define liblldb_Event_h_
 
 #include "lldb/Core/Broadcaster.h"
-#include "lldb/Host/Predicate.h"
 #include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Predicate.h"
 #include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
 #include "lldb/lldb-forward.h" // for EventDataSP, ProcessSP, Struct...
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to