diff options
| author | Pavel Labath <labath@google.com> | 2017-11-13 15:57:20 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2017-11-13 15:57:20 +0000 |
| commit | 4ebb64b95fe22ec7916afdf7445bb4256ccfccf1 (patch) | |
| tree | 3036fb6104b1ee892f35dfcf5e850de11b195ca1 /lldb/source/Host/common/HostInfoBase.cpp | |
| parent | 44156a0efb92b178d3a0fdaf8af97a29778c0b2c (diff) | |
| download | bcm5719-llvm-4ebb64b95fe22ec7916afdf7445bb4256ccfccf1.tar.gz bcm5719-llvm-4ebb64b95fe22ec7916afdf7445bb4256ccfccf1.zip | |
Remove last Host usage from ArchSpec
Summary:
In D39387, I was quick to jump to conclusion that ArchSpec has no
external dependencies. It turns there still was one call to
HostInfo::GetArchitecture left -- for implementing the "systemArch32"
architecture and friends.
Since GetAugmentedArchSpec is the place we handle these "incomplete"
triples that don't specify os or vendor and "systemArch" looks very much
like an incomplete triple, I move its handling there.
After this ArchSpec *really* does not have external dependencies, and
I'll move it to the Utility module as a follow-up.
Reviewers: zturner, clayborg, jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D39896
llvm-svn: 318046
Diffstat (limited to 'lldb/source/Host/common/HostInfoBase.cpp')
| -rw-r--r-- | lldb/source/Host/common/HostInfoBase.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp index 1362a0cdd46..c703a93566a 100644 --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -103,6 +103,14 @@ const ArchSpec &HostInfoBase::GetArchitecture(ArchitectureKind arch_kind) { : g_fields->m_host_arch_32; } +llvm::Optional<HostInfoBase::ArchitectureKind> HostInfoBase::ParseArchitectureKind(llvm::StringRef kind) { + return llvm::StringSwitch<llvm::Optional<ArchitectureKind>>(kind) + .Case(LLDB_ARCH_DEFAULT, eArchKindDefault) + .Case(LLDB_ARCH_DEFAULT_32BIT, eArchKind32) + .Case(LLDB_ARCH_DEFAULT_64BIT, eArchKind64) + .Default(llvm::None); +} + bool HostInfoBase::GetLLDBPath(lldb::PathType type, FileSpec &file_spec) { file_spec.Clear(); @@ -258,6 +266,9 @@ ArchSpec HostInfoBase::GetAugmentedArchSpec(llvm::StringRef triple) { if (!ArchSpec::ContainsOnlyArch(normalized_triple)) return ArchSpec(triple); + if (auto kind = HostInfo::ParseArchitectureKind(triple)) + return HostInfo::GetArchitecture(*kind); + llvm::Triple host_triple(llvm::sys::getDefaultTargetTriple()); if (normalized_triple.getVendorName().empty()) |

