Skip to content

Commit

Permalink
Move SafeMachO from Utility to Host
Browse files Browse the repository at this point in the history
Summary:
One of the conclusions of the discussion on D49740 was that SafeMachO is better
off in the Host module (as that's the only place which should include
mach/machine.h, which is what this header is working around). Also, Utility,
which is the only module which cannot include Host, should not be doing
anything with object file formats.

This patch implements that move, and also removes any unneded includes of that
file.

I've verified that MacOS still compiles after this.

Reviewers: jingham, zturner, teemperor

Subscribers: fedor.sergeev, lldb-commits

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

llvm-svn: 342050
  • Loading branch information
labath committed Sep 12, 2018
1 parent 2d77e78 commit 7704473
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 17 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions lldb/include/lldb/module.modulemap
Expand Up @@ -41,6 +41,7 @@ module lldb_Host {
module ProcessLauncher { header "Host/ProcessLauncher.h" export * }
module ProcessRunLock { header "Host/ProcessRunLock.h" export * }
module PseudoTerminal { header "Host/PseudoTerminal.h" export * }
module SafeMachO { header "Host/SafeMachO.h" export * }
module SocketAddress { header "Host/SocketAddress.h" export * }
module Socket { header "Host/Socket.h" export * }
module StringConvert { header "Host/StringConvert.h" export * }
Expand Down
2 changes: 0 additions & 2 deletions lldb/source/Host/common/Symbols.cpp
Expand Up @@ -16,7 +16,6 @@
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
Expand All @@ -29,7 +28,6 @@ typedef int cpu_subtype_t;

using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;

#if defined(__APPLE__)

Expand Down
2 changes: 0 additions & 2 deletions lldb/source/Host/macosx/Symbols.cpp
Expand Up @@ -10,7 +10,6 @@
#include "lldb/Host/Symbols.h"

// C Includes
#include "lldb/Utility/SafeMachO.h"
#include <dirent.h>
#include <pwd.h>

Expand Down Expand Up @@ -42,7 +41,6 @@

using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;

#if !defined(__arm__) && !defined(__arm64__) && \
!defined(__aarch64__) // No DebugSymbols on the iOS devices
Expand Down
1 change: 0 additions & 1 deletion lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
Expand Up @@ -11,7 +11,6 @@
#include "lldb/Host/macosx/HostInfoMacOSX.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/SafeMachO.h"

#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FileSystem.h"
Expand Down
Expand Up @@ -18,7 +18,7 @@

// Other libraries and framework includes

#include "lldb/Utility/SafeMachO.h"
#include "lldb/Host/SafeMachO.h"

// Project includes
#include "lldb/Target/DynamicLoader.h"
Expand Down
Expand Up @@ -18,10 +18,10 @@

// Other libraries and framework includes
// Project includes
#include "lldb/Host/SafeMachO.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"

Expand Down
Expand Up @@ -28,7 +28,6 @@
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"

Expand Down
Expand Up @@ -28,10 +28,10 @@

// Other libraries and framework includes
// Project includes
#include "lldb/Host/SafeMachO.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"

Expand Down
Expand Up @@ -14,9 +14,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Host/SafeMachO.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"

class ObjectContainerUniversalMachO : public lldb_private::ObjectContainer {
public:
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Expand Up @@ -46,7 +46,7 @@
#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"

#include "lldb/Utility/SafeMachO.h"
#include "lldb/Host/SafeMachO.h"

#include "llvm/Support/MemoryBuffer.h"

Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
Expand Up @@ -17,9 +17,9 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Host/SafeMachO.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/UUID.h"

//----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
Expand Up @@ -9,7 +9,7 @@

#include "ThreadKDP.h"

#include "lldb/Utility/SafeMachO.h"
#include "lldb/Host/SafeMachO.h"

#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Target/Process.h"
Expand Down
Expand Up @@ -28,6 +28,7 @@
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/SafeMachO.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/FileAction.h"
Expand All @@ -36,7 +37,6 @@
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/JSON.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StreamGDBRemote.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/Triple.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
Expand Up @@ -39,7 +39,7 @@
#include "ThreadMachCore.h"

// Needed for the plug-in names for the dynamic loaders.
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Host/SafeMachO.h"

#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
Expand Down
2 changes: 0 additions & 2 deletions lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
Expand Up @@ -9,8 +9,6 @@

#include "ThreadMachCore.h"

#include "lldb/Utility/SafeMachO.h"

#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
Expand Down

0 comments on commit 7704473

Please sign in to comment.