diff options
author | Alex Langford <apl@fb.com> | 2019-02-26 23:50:19 +0000 |
---|---|---|
committer | Alex Langford <apl@fb.com> | 2019-02-26 23:50:19 +0000 |
commit | bee015efb5ff0864884f7a17cb79373808e1958f (patch) | |
tree | 80966f9381dda482840b4765d86cb9b6f0b2209a /lldb/source | |
parent | 27f79151ec89048103b0427f20b6e4e927718216 (diff) | |
download | bcm5719-llvm-bee015efb5ff0864884f7a17cb79373808e1958f.tar.gz bcm5719-llvm-bee015efb5ff0864884f7a17cb79373808e1958f.zip |
[Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpec
Summary:
These functions should always return the opposite of the
`Triple{Environment,OS,Vendor}WasSpecified` functions. Unspecified unknown is
the same as unspecified, which is why one set of functions should give us what
we want. It's possible to have specified unknown, which is why we can't just
rely on checking the enum values of vendor/os/environment. We must also ensure
that the names of these are empty and not "unknown".
Differential Revision: https://reviews.llvm.org/D58653
llvm-svn: 354933
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Utility/ArchSpec.cpp | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index b6f27fccde9..03726554205 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -3309,7 +3309,7 @@ ArchSpec ObjectFileELF::GetArchitecture() { } if (CalculateType() == eTypeCoreFile && - m_arch_spec.TripleOSIsUnspecifiedUnknown()) { + !m_arch_spec.TripleOSWasSpecified()) { // Core files don't have section headers yet they have PT_NOTE program // headers that might shed more light on the architecture for (const elf::ELFProgramHeader &H : ProgramHeaders()) { diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 37432465745..b28119b3b9d 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -889,10 +889,9 @@ bool ArchSpec::ContainsOnlyArch(const llvm::Triple &normalized_triple) { } void ArchSpec::MergeFrom(const ArchSpec &other) { - if (TripleVendorIsUnspecifiedUnknown() && - !other.TripleVendorIsUnspecifiedUnknown()) + if (!TripleVendorWasSpecified() && other.TripleVendorWasSpecified()) GetTriple().setVendor(other.GetTriple().getVendor()); - if (TripleOSIsUnspecifiedUnknown() && !other.TripleOSIsUnspecifiedUnknown()) + if (!TripleOSWasSpecified() && other.TripleVendorWasSpecified()) GetTriple().setOS(other.GetTriple().getOS()); if (GetTriple().getArch() == llvm::Triple::UnknownArch) { GetTriple().setArch(other.GetTriple().getArch()); @@ -903,8 +902,8 @@ void ArchSpec::MergeFrom(const ArchSpec &other) { if (other.GetCore() != eCore_uknownMach64) UpdateCore(); } - if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment && - !TripleVendorWasSpecified()) { + if (!TripleEnvironmentWasSpecified() && + other.TripleEnvironmentWasSpecified() && !TripleVendorWasSpecified()) { if (other.TripleVendorWasSpecified()) GetTriple().setEnvironment(other.GetTriple().getEnvironment()); } |