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
This commit is contained in:
Pavel Labath 2017-07-18 13:14:01 +00:00
parent 30fc523984
commit b6dbe9a99c
26 changed files with 29 additions and 39 deletions

View File

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

View File

@ -16,6 +16,8 @@
#if defined(_WIN32)
#include "lldb/Host/windows/PosixApi.h"
#else
#include <unistd.h>
#endif
#endif

View File

@ -15,6 +15,7 @@
#include "lldb/lldb-forward.h" // for DataBufferSP
#include "lldb/lldb-types.h"
#include <cassert>
#include <stdint.h>
#include <string.h>

View File

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

View File

@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#endif
#include "llvm/Support/ConvertUTF.h"

View File

@ -29,6 +29,7 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#endif
#ifdef __linux__

View File

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

View File

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

View File

@ -16,6 +16,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <algorithm>
#include <mutex> // std::once

View File

@ -30,6 +30,7 @@
#ifndef LLDB_DISABLE_POSIX
#include <termios.h>
#include <unistd.h>
#endif
// C++ Includes

View File

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

View File

@ -13,7 +13,9 @@
#include "llvm/ADT/STLExtras.h"
#include <csignal>
#include <limits.h>
#include <unistd.h>
using namespace lldb_private;

View File

@ -10,6 +10,7 @@
#include "lldb/Host/posix/LockFilePosix.h"
#include <fcntl.h>
#include <unistd.h>
using namespace lldb;
using namespace lldb_private;

View File

@ -19,6 +19,7 @@
#include <limits.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sstream>

View File

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

View File

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

View File

@ -10,7 +10,7 @@
#ifndef liblldb_NativeProcessLinux_H_
#define liblldb_NativeProcessLinux_H_
// C++ Includes
#include <csignal>
#include <unordered_set>
// Other libraries and framework includes

View File

@ -14,6 +14,7 @@
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "lldb/lldb-private-forward.h"
#include <csignal>
#include <map>
#include <memory>
#include <string>

View File

@ -18,6 +18,7 @@
#include <linux/perf_event.h>
#include <sys/mman.h>
#include <unistd.h>
namespace lldb_private {

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@
#include "Driver.h"
#include <csignal>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>

View File

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

View File

@ -9,6 +9,8 @@
// Third party headers:
#include "lldb/API/SBError.h"
#include <cassert>
#include <csignal>
#include <fstream>
// In-house headers:

View File

@ -33,6 +33,7 @@
// Third party headers:
#include "lldb/API/SBHostOS.h"
#include <csignal>
#include <stdio.h>
// In house headers: