Invert ArchSpec<->Platform dependency
authorPavel Labath <labath@google.com>
Tue, 31 Oct 2017 10:56:03 +0000 (10:56 +0000)
committerPavel Labath <labath@google.com>
Tue, 31 Oct 2017 10:56:03 +0000 (10:56 +0000)
commit7263f1bda695772732c5a8ddbed2d07713a7e59c
tree57f62e5fddb72b7aca0e9410f53d1e5f49b20210
parent64f53b42144e36820a6a56c5fc08d1f5d4ded9bd
Invert ArchSpec<->Platform dependency

Summary:
ArchSpec::SetTriple was taking a Platform as an argument, and used it to
fill in missing pieces of the specified triple. I invert the dependency
by moving this code to other classes. For this purpose, I've created
three new functions.
- HostInfo::GetAugmentedArchSpec: fills in the triple using the host
  platform (this used to be implemented by passing a null platform
  pointer). By putting this code in the Host module, we can provide a
  way to anyone who does not have a platform instance (lldb-server) an
  easy way to get Host data.
- Platform::GetAugmentedArchSpec: if you have a platform instance, you
  can call this to let it fill in the triple.
- static Platform::GetAugmentedArchSpec: implements the "if platform ==
  0 then use_host() else use_platform()" part.

Reviewers: zturner, jingham, clayborg

Subscribers: mgorny, javed.absar, lldb-commits

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

llvm-svn: 316987
18 files changed:
lldb/include/lldb/Core/ArchSpec.h
lldb/include/lldb/Host/HostInfoBase.h
lldb/include/lldb/Target/Platform.h
lldb/source/API/SBDebugger.cpp
lldb/source/API/SBInstruction.cpp
lldb/source/API/SBTarget.cpp
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Core/ArchSpec.cpp
lldb/source/Host/common/HostInfoBase.cpp
lldb/source/Interpreter/OptionGroupArchitecture.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/unittests/Host/CMakeLists.txt
lldb/unittests/Host/HostInfoTest.cpp [new file with mode: 0644]
lldb/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp