Move Predicate.h from Host to Utility

Summary:
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).

Reviewers: jingham, zturner, teemperor

Reviewed By: zturner

Subscribers: xiaobai, mgorny, lldb-commits

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

llvm-svn: 341089
This commit is contained in:
Raphael Isemann 2018-08-30 17:51:10 +00:00
parent b7e14332ea
commit 7fae4932ad
17 changed files with 18 additions and 19 deletions

View File

@ -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...

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -34,11 +34,11 @@ typedef enum {
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 @@ protected:
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:
//------------------------------------------------------------------

View File

@ -38,7 +38,6 @@ module lldb_Host {
module PipeBase { header "Host/PipeBase.h" export * }
module Pipe { header "Host/Pipe.h" export * }
module PosixApi { header "Host/PosixApi.h" export * }
module Predicate { header "Host/Predicate.h" export * }
module ProcessLauncher { header "Host/ProcessLauncher.h" export * }
module ProcessRunLock { header "Host/ProcessRunLock.h" export * }
module PseudoTerminal { header "Host/PseudoTerminal.h" export * }

View File

@ -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

View File

@ -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"

View File

@ -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 {

View File

@ -12,7 +12,6 @@
#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"
@ -21,6 +20,7 @@
#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"

View File

@ -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 {

View File

@ -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"

View File

@ -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>

View File

@ -3,7 +3,6 @@ set (FILES
HostInfoTest.cpp
HostTest.cpp
MainLoopTest.cpp
PredicateTest.cpp
SocketAddressTest.cpp
SocketTest.cpp
SymbolsTest.cpp

View File

@ -12,6 +12,7 @@ add_lldb_unittest(UtilityTests
JSONTest.cpp
LogTest.cpp
NameMatchesTest.cpp
PredicateTest.cpp
RegisterValueTest.cpp
ScalarTest.cpp
StateTest.cpp

View File

@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "lldb/Host/Predicate.h"
#include "lldb/Utility/Predicate.h"
#include "gtest/gtest.h"
#include <thread>