summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-07-18 13:14:01 +0000
committerPavel Labath <labath@google.com>2017-07-18 13:14:01 +0000
commitb6dbe9a99c35b5dd101d45f220f95f6e9e85d15e (patch)
treea9522e28f97a4f14f49be49f0249141c23079fca
parent30fc523984dec81232167e07d8fc25c92e8562f7 (diff)
downloadbcm5719-llvm-b6dbe9a99c35b5dd101d45f220f95f6e9e85d15e.tar.gz
bcm5719-llvm-b6dbe9a99c35b5dd101d45f220f95f6e9e85d15e.zip
Clean up lldb-types.h
Summary: It defined a couple of types (condition_t) which we don't use anymore, as we have c++11 goodies now. I remove these definitions. Also it unnecessarily included a couple of headers which weren't necessary for it's operation. I remove these, and place the includes in the relevant files (usually .cpp, usually in Host code) which use them. This allows us to reduce namespace pollution in most of the lldb files which don't need the OS-specific definitions. Reviewers: zturner, jingham Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D35113 llvm-svn: 308304
-rw-r--r--lldb/include/lldb/Host/MainLoop.h2
-rw-r--r--lldb/include/lldb/Host/PosixApi.h2
-rw-r--r--lldb/include/lldb/Utility/DataExtractor.h1
-rw-r--r--lldb/include/lldb/lldb-types.h24
-rw-r--r--lldb/source/Host/common/File.cpp1
-rw-r--r--lldb/source/Host/common/Socket.cpp1
-rw-r--r--lldb/source/Host/common/TCPSocket.cpp1
-rw-r--r--lldb/source/Host/linux/Host.cpp1
-rw-r--r--lldb/source/Host/linux/HostInfoLinux.cpp1
-rw-r--r--lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp1
-rw-r--r--lldb/source/Host/posix/FileSystem.cpp1
-rw-r--r--lldb/source/Host/posix/HostProcessPosix.cpp2
-rw-r--r--lldb/source/Host/posix/LockFilePosix.cpp1
-rw-r--r--lldb/source/Host/posix/ProcessLauncherPosixFork.cpp1
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp14
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp1
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.h2
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeThreadLinux.h1
-rw-r--r--lldb/source/Plugins/Process/Linux/ProcessorTrace.h1
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp1
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp2
-rw-r--r--lldb/source/Target/Target.cpp1
-rw-r--r--lldb/tools/driver/Driver.cpp1
-rw-r--r--lldb/tools/lldb-mi/MICmnLLDBDebugger.cpp1
-rw-r--r--lldb/tools/lldb-mi/MIDriver.cpp2
-rw-r--r--lldb/tools/lldb-mi/MIDriverMain.cpp1
26 files changed, 29 insertions, 39 deletions
diff --git a/lldb/include/lldb/Host/MainLoop.h b/lldb/include/lldb/Host/MainLoop.h
index a722348b884..5ac145ff865 100644
--- a/lldb/include/lldb/Host/MainLoop.h
+++ b/lldb/include/lldb/Host/MainLoop.h
@@ -12,8 +12,8 @@
#include "lldb/Host/Config.h"
#include "lldb/Host/MainLoopBase.h"
-
#include "llvm/ADT/DenseMap.h"
+#include <csignal>
#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H
#define SIGNAL_POLLING_UNSUPPORTED 1
diff --git a/lldb/include/lldb/Host/PosixApi.h b/lldb/include/lldb/Host/PosixApi.h
index 02324307dc9..d5c48dd6d17 100644
--- a/lldb/include/lldb/Host/PosixApi.h
+++ b/lldb/include/lldb/Host/PosixApi.h
@@ -16,6 +16,8 @@
#if defined(_WIN32)
#include "lldb/Host/windows/PosixApi.h"
+#else
+#include <unistd.h>
#endif
#endif
diff --git a/lldb/include/lldb/Utility/DataExtractor.h b/lldb/include/lldb/Utility/DataExtractor.h
index 58240d9a526..4ef78c1af49 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -15,6 +15,7 @@
#include "lldb/lldb-forward.h" // for DataBufferSP
#include "lldb/lldb-types.h"
+#include <cassert>
#include <stdint.h>
#include <string.h>
diff --git a/lldb/include/lldb/lldb-types.h b/lldb/include/lldb/lldb-types.h
index 07e9f5ac716..fc445f55a9e 100644
--- a/lldb/include/lldb/lldb-types.h
+++ b/lldb/include/lldb/lldb-types.h
@@ -13,16 +13,10 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
-#include <assert.h>
-#include <signal.h>
#include <stdint.h>
//----------------------------------------------------------------------
// All host systems must define:
-// lldb::condition_t The native condition type (or a substitute class)
-// for conditions on the host system.
-// lldb::mutex_t The native mutex type for mutex objects on the host
-// system.
// lldb::thread_t The native thread type for spawned threads on the
// system
// lldb::thread_arg_t The type of the one any only thread creation
@@ -34,32 +28,22 @@
// #define LLDB_INVALID_PROCESS_ID ...
// #define LLDB_INVALID_THREAD_ID ...
// #define LLDB_INVALID_HOST_THREAD ...
-// #define IS_VALID_LLDB_HOST_THREAD ...
//----------------------------------------------------------------------
// TODO: Add a bunch of ifdefs to determine the host system and what
// things should be defined. Currently MacOSX is being assumed by default
// since that is what lldb was first developed for.
-#ifndef _MSC_VER
-#include <stdbool.h>
-#include <unistd.h>
-#endif
-
#ifdef _WIN32
#include <process.h>
namespace lldb {
-typedef void *mutex_t;
-typedef void *condition_t;
typedef void *rwlock_t;
typedef void *process_t; // Process type is HANDLE
typedef void *thread_t; // Host thread type
typedef void *file_t; // Host file type
-typedef void *pipe_t; // Host pipe type
typedef unsigned int __w64 socket_t; // Host socket type
-typedef uint32_t thread_key_t;
typedef void *thread_arg_t; // Host thread argument type
typedef unsigned thread_result_t; // Host thread result type
typedef thread_result_t (*thread_func_t)(void *); // Host thread function type
@@ -73,15 +57,11 @@ namespace lldb {
//----------------------------------------------------------------------
// MacOSX Types
//----------------------------------------------------------------------
-typedef ::pthread_mutex_t mutex_t;
-typedef pthread_cond_t condition_t;
typedef pthread_rwlock_t rwlock_t;
typedef uint64_t process_t; // Process type is just a pid.
typedef pthread_t thread_t; // Host thread type
typedef int file_t; // Host file type
-typedef int pipe_t; // Host pipe type
typedef int socket_t; // Host socket type
-typedef pthread_key_t thread_key_t;
typedef void *thread_arg_t; // Host thread argument type
typedef void *thread_result_t; // Host thread result type
typedef void *(*thread_func_t)(void *); // Host thread function type
@@ -100,10 +80,6 @@ typedef bool (*ExpressionCancelCallback)(ExpressionEvaluationPhase phase,
#define LLDB_INVALID_PROCESS ((lldb::process_t)-1)
#define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
-#define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD)
-
-#define LLDB_INVALID_HOST_TIME \
- { 0, 0 }
namespace lldb {
typedef uint64_t addr_t;
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index 90a4462c6ca..6ee4e894756 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
+#include <unistd.h>
#endif
#include "llvm/Support/ConvertUTF.h"
diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp
index 0df9dc02c70..5490e9b30bd 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -29,6 +29,7 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <unistd.h>
#endif
#ifdef __linux__
diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp
index c013334ce23..a7af93f10a7 100644
--- a/lldb/source/Host/common/TCPSocket.cpp
+++ b/lldb/source/Host/common/TCPSocket.cpp
@@ -34,6 +34,7 @@
#define CLOSE_SOCKET closesocket
typedef const char *set_socket_option_arg_type;
#else
+#include <unistd.h>
#define CLOSE_SOCKET ::close
typedef const void *set_socket_option_arg_type;
#endif
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index 486d4e3f0b8..f43090eadf8 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -16,6 +16,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <unistd.h>
// C++ Includes
// Other libraries and framework includes
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 3ff722d5c10..8d59cda249e 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
+#include <unistd.h>
#include <algorithm>
#include <mutex> // std::once
diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 105ef0f23d4..3797650105c 100644
--- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -30,6 +30,7 @@
#ifndef LLDB_DISABLE_POSIX
#include <termios.h>
+#include <unistd.h>
#endif
// C++ Includes
diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp
index e5a99e1aa75..3ece0677f99 100644
--- a/lldb/source/Host/posix/FileSystem.cpp
+++ b/lldb/source/Host/posix/FileSystem.cpp
@@ -15,6 +15,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#ifdef __linux__
#include <linux/magic.h>
#include <sys/mount.h>
diff --git a/lldb/source/Host/posix/HostProcessPosix.cpp b/lldb/source/Host/posix/HostProcessPosix.cpp
index b5505dbec65..3c5273f4bd3 100644
--- a/lldb/source/Host/posix/HostProcessPosix.cpp
+++ b/lldb/source/Host/posix/HostProcessPosix.cpp
@@ -13,7 +13,9 @@
#include "llvm/ADT/STLExtras.h"
+#include <csignal>
#include <limits.h>
+#include <unistd.h>
using namespace lldb_private;
diff --git a/lldb/source/Host/posix/LockFilePosix.cpp b/lldb/source/Host/posix/LockFilePosix.cpp
index 2b7d548a021..05423062bd4 100644
--- a/lldb/source/Host/posix/LockFilePosix.cpp
+++ b/lldb/source/Host/posix/LockFilePosix.cpp
@@ -10,6 +10,7 @@
#include "lldb/Host/posix/LockFilePosix.h"
#include <fcntl.h>
+#include <unistd.h>
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
index 0b40c24256e..9b3f6fbf15c 100644
--- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
+++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
@@ -19,6 +19,7 @@
#include <limits.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
+#include <unistd.h>
#include <sstream>
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
index 5dbb3bb4ef7..7dd2b57da0c 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp
@@ -7,24 +7,12 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-// C++ Includes
-// Other libraries and framework includes
+#include "AuxVector.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
-#if defined(__linux__) || defined(__FreeBSD__)
-#include "Plugins/Process/elf-core/ProcessElfCore.h"
-#endif
-
-#include "AuxVector.h"
-
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 645bfdfa770..759ec7fd1d2 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -23,6 +23,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/FileSpec.h"
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index a06a6204c82..c9ec002760f 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -10,7 +10,7 @@
#ifndef liblldb_NativeProcessLinux_H_
#define liblldb_NativeProcessLinux_H_
-// C++ Includes
+#include <csignal>
#include <unordered_set>
// Other libraries and framework includes
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
index 54bec3d7750..6ae87feffcd 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
@@ -14,6 +14,7 @@
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/lldb-private-forward.h"
+#include <csignal>
#include <map>
#include <memory>
#include <string>
diff --git a/lldb/source/Plugins/Process/Linux/ProcessorTrace.h b/lldb/source/Plugins/Process/Linux/ProcessorTrace.h
index ddcaf0f842b..6603c7d6047 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessorTrace.h
+++ b/lldb/source/Plugins/Process/Linux/ProcessorTrace.h
@@ -18,6 +18,7 @@
#include <linux/perf_event.h>
#include <sys/mman.h>
+#include <unistd.h>
namespace lldb_private {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index dddda311bb6..9294359dbef 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -29,6 +29,7 @@
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
#include "lldb/Host/common/NativeRegisterContext.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 8a66f3865eb..be11dd9bc7e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -16,6 +16,7 @@
#include <netinet/in.h>
#include <sys/mman.h> // for mmap
#include <sys/socket.h>
+#include <unistd.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
@@ -40,6 +41,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostThread.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Host/Symbols.h"
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 4632ada26ed..d97f651ca08 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -34,6 +34,7 @@
#include "lldb/Expression/REPL.h"
#include "lldb/Expression/UserExpression.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/PosixApi.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/OptionGroupWatchpoint.h"
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 8e226a97af3..102ba775da9 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -9,6 +9,7 @@
#include "Driver.h"
+#include <csignal>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
diff --git a/lldb/tools/lldb-mi/MICmnLLDBDebugger.cpp b/lldb/tools/lldb-mi/MICmnLLDBDebugger.cpp
index a676ecc9260..b102cab9f93 100644
--- a/lldb/tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ b/lldb/tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -17,6 +17,7 @@
#include "lldb/API/SBTypeCategory.h"
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBTypeSummary.h"
+#include <cassert>
// In-house headers:
#include "MICmnLLDBDebugSessionInfo.h"
diff --git a/lldb/tools/lldb-mi/MIDriver.cpp b/lldb/tools/lldb-mi/MIDriver.cpp
index 49e8588bf73..7bd6b7b2e16 100644
--- a/lldb/tools/lldb-mi/MIDriver.cpp
+++ b/lldb/tools/lldb-mi/MIDriver.cpp
@@ -9,6 +9,8 @@
// Third party headers:
#include "lldb/API/SBError.h"
+#include <cassert>
+#include <csignal>
#include <fstream>
// In-house headers:
diff --git a/lldb/tools/lldb-mi/MIDriverMain.cpp b/lldb/tools/lldb-mi/MIDriverMain.cpp
index fdced8dd4ea..be01f1d9779 100644
--- a/lldb/tools/lldb-mi/MIDriverMain.cpp
+++ b/lldb/tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
// Third party headers:
#include "lldb/API/SBHostOS.h"
+#include <csignal>
#include <stdio.h>
// In house headers:
OpenPOWER on IntegriCloud