Author: labath Date: Tue Jul 18 06:14:01 2017 New Revision: 308304 URL: http://llvm.org/viewvc/llvm-project?rev=308304&view=rev Log: 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 Modified: lldb/trunk/include/lldb/Host/MainLoop.h lldb/trunk/include/lldb/Host/PosixApi.h lldb/trunk/include/lldb/Utility/DataExtractor.h lldb/trunk/include/lldb/lldb-types.h lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/Socket.cpp lldb/trunk/source/Host/common/TCPSocket.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Host/posix/HostProcessPosix.cpp lldb/trunk/source/Host/posix/LockFilePosix.cpp lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp lldb/trunk/tools/lldb-mi/MIDriver.cpp lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Modified: lldb/trunk/include/lldb/Host/MainLoop.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MainLoop.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/MainLoop.h (original) +++ lldb/trunk/include/lldb/Host/MainLoop.h Tue Jul 18 06:14:01 2017 @@ -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 Modified: lldb/trunk/include/lldb/Host/PosixApi.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PosixApi.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/PosixApi.h (original) +++ lldb/trunk/include/lldb/Host/PosixApi.h Tue Jul 18 06:14:01 2017 @@ -16,6 +16,8 @@ #if defined(_WIN32) #include "lldb/Host/windows/PosixApi.h" +#else +#include <unistd.h> #endif #endif Modified: lldb/trunk/include/lldb/Utility/DataExtractor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataExtractor.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/DataExtractor.h (original) +++ lldb/trunk/include/lldb/Utility/DataExtractor.h Tue Jul 18 06:14:01 2017 @@ -15,6 +15,7 @@ #include "lldb/lldb-forward.h" // for DataBufferSP #include "lldb/lldb-types.h" +#include <cassert> #include <stdint.h> #include <string.h> Modified: lldb/trunk/include/lldb/lldb-types.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-types.h (original) +++ lldb/trunk/include/lldb/lldb-types.h Tue Jul 18 06:14:01 2017 @@ -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) #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; Modified: lldb/trunk/source/Host/common/File.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/common/File.cpp (original) +++ lldb/trunk/source/Host/common/File.cpp Tue Jul 18 06:14:01 2017 @@ -21,6 +21,7 @@ #include <sys/ioctl.h> #include <sys/stat.h> #include <termios.h> +#include <unistd.h> #endif #include "llvm/Support/ConvertUTF.h" Modified: lldb/trunk/source/Host/common/Socket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Socket.cpp (original) +++ lldb/trunk/source/Host/common/Socket.cpp Tue Jul 18 06:14:01 2017 @@ -29,6 +29,7 @@ #include <netinet/tcp.h> #include <sys/socket.h> #include <sys/un.h> +#include <unistd.h> #endif #ifdef __linux__ Modified: lldb/trunk/source/Host/common/TCPSocket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TCPSocket.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/common/TCPSocket.cpp (original) +++ lldb/trunk/source/Host/common/TCPSocket.cpp Tue Jul 18 06:14:01 2017 @@ -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 Modified: lldb/trunk/source/Host/linux/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/linux/Host.cpp (original) +++ lldb/trunk/source/Host/linux/Host.cpp Tue Jul 18 06:14:01 2017 @@ -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 Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original) +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Tue Jul 18 06:14:01 2017 @@ -16,6 +16,7 @@ #include <stdio.h> #include <string.h> #include <sys/utsname.h> +#include <unistd.h> #include <algorithm> #include <mutex> // std::once Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original) +++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Tue Jul 18 06:14:01 2017 @@ -30,6 +30,7 @@ #ifndef LLDB_DISABLE_POSIX #include <termios.h> +#include <unistd.h> #endif // C++ Includes Modified: lldb/trunk/source/Host/posix/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/FileSystem.cpp (original) +++ lldb/trunk/source/Host/posix/FileSystem.cpp Tue Jul 18 06:14:01 2017 @@ -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> Modified: lldb/trunk/source/Host/posix/HostProcessPosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostProcessPosix.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/HostProcessPosix.cpp (original) +++ lldb/trunk/source/Host/posix/HostProcessPosix.cpp Tue Jul 18 06:14:01 2017 @@ -13,7 +13,9 @@ #include "llvm/ADT/STLExtras.h" +#include <csignal> #include <limits.h> +#include <unistd.h> using namespace lldb_private; Modified: lldb/trunk/source/Host/posix/LockFilePosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/LockFilePosix.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/LockFilePosix.cpp (original) +++ lldb/trunk/source/Host/posix/LockFilePosix.cpp Tue Jul 18 06:14:01 2017 @@ -10,6 +10,7 @@ #include "lldb/Host/posix/LockFilePosix.h" #include <fcntl.h> +#include <unistd.h> using namespace lldb; using namespace lldb_private; Modified: lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp (original) +++ lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp Tue Jul 18 06:14:01 2017 @@ -19,6 +19,7 @@ #include <limits.h> #include <sys/ptrace.h> #include <sys/wait.h> +#include <unistd.h> #include <sstream> Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/AuxVector.cpp Tue Jul 18 06:14:01 2017 @@ -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; Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original) +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Tue Jul 18 06:14:01 2017 @@ -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" Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Tue Jul 18 06:14:01 2017 @@ -10,7 +10,7 @@ #ifndef liblldb_NativeProcessLinux_H_ #define liblldb_NativeProcessLinux_H_ -// C++ Includes +#include <csignal> #include <unordered_set> // Other libraries and framework includes Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.h Tue Jul 18 06:14:01 2017 @@ -14,6 +14,7 @@ #include "lldb/Host/common/NativeThreadProtocol.h" #include "lldb/lldb-private-forward.h" +#include <csignal> #include <map> #include <memory> #include <string> Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h Tue Jul 18 06:14:01 2017 @@ -18,6 +18,7 @@ #include <linux/perf_event.h> #include <sys/mman.h> +#include <unistd.h> namespace lldb_private { Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Tue Jul 18 06:14:01 2017 @@ -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" Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jul 18 06:14:01 2017 @@ -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" Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Tue Jul 18 06:14:01 2017 @@ -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" Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Tue Jul 18 06:14:01 2017 @@ -9,6 +9,7 @@ #include "Driver.h" +#include <csignal> #include <fcntl.h> #include <limits.h> #include <stdio.h> Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Tue Jul 18 06:14:01 2017 @@ -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" Modified: lldb/trunk/tools/lldb-mi/MIDriver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriver.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MIDriver.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIDriver.cpp Tue Jul 18 06:14:01 2017 @@ -9,6 +9,8 @@ // Third party headers: #include "lldb/API/SBError.h" +#include <cassert> +#include <csignal> #include <fstream> // In-house headers: Modified: lldb/trunk/tools/lldb-mi/MIDriverMain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIDriverMain.cpp?rev=308304&r1=308303&r2=308304&view=diff ============================================================================== --- lldb/trunk/tools/lldb-mi/MIDriverMain.cpp (original) +++ lldb/trunk/tools/lldb-mi/MIDriverMain.cpp Tue Jul 18 06:14:01 2017 @@ -33,6 +33,7 @@ // Third party headers: #include "lldb/API/SBHostOS.h" +#include <csignal> #include <stdio.h> // In house headers: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits