diff options
author | Sean Callanan <scallanan@apple.com> | 2012-12-13 22:07:14 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-12-13 22:07:14 +0000 |
commit | bf4b7be68ee9da3cc43fedee101457140d3330cd (patch) | |
tree | 504cacce4cac1112fd46c89a9e5f39a3d3c232e4 /lldb/source/Core/ArchSpec.cpp | |
parent | 3960540e305dd27dc20e5e038f499149ddf5c4db (diff) | |
download | bcm5719-llvm-bf4b7be68ee9da3cc43fedee101457140d3330cd.tar.gz bcm5719-llvm-bf4b7be68ee9da3cc43fedee101457140d3330cd.zip |
Removed the == and != operators from ArchSpec, since
equality can be strict or loose and we want code to
explicitly choose one or the other.
Also renamed the Compare function to IsEqualTo, to
avoid confusion.
<rdar://problem/12856749>
llvm-svn: 170152
Diffstat (limited to 'lldb/source/Core/ArchSpec.cpp')
-rw-r--r-- | lldb/source/Core/ArchSpec.cpp | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index 30b057b4fa6..e020c2107b5 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -717,17 +717,17 @@ ArchSpec::GetMaximumOpcodeByteSize() const bool ArchSpec::IsExactMatch (const ArchSpec& rhs) const { - return Compare (rhs, true); + return IsEqualTo (rhs, true); } bool ArchSpec::IsCompatibleMatch (const ArchSpec& rhs) const { - return Compare (rhs, false); + return IsEqualTo (rhs, false); } bool -ArchSpec::Compare (const ArchSpec& rhs, bool exact_match) const +ArchSpec::IsEqualTo (const ArchSpec& rhs, bool exact_match) const { if (GetByteOrder() != rhs.GetByteOrder()) return false; @@ -746,12 +746,15 @@ ArchSpec::Compare (const ArchSpec& rhs, bool exact_match) const const llvm::Triple::VendorType rhs_triple_vendor = rhs_triple.getVendor(); if (lhs_triple_vendor != rhs_triple_vendor) { - const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); - const bool lhs_vendor_specified = TripleVendorWasSpecified(); - // Both architectures had the vendor specified, so if they aren't - // equal then we return false - if (rhs_vendor_specified && lhs_vendor_specified) - return false; + if (exact_match) + { + const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); + const bool lhs_vendor_specified = TripleVendorWasSpecified(); + // Both architectures had the vendor specified, so if they aren't + // equal then we return false + if (rhs_vendor_specified && lhs_vendor_specified) + return false; + } // Only fail if both vendor types are not unknown if (lhs_triple_vendor != llvm::Triple::UnknownVendor && @@ -763,12 +766,15 @@ ArchSpec::Compare (const ArchSpec& rhs, bool exact_match) const const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS(); if (lhs_triple_os != rhs_triple_os) { - const bool rhs_os_specified = rhs.TripleOSWasSpecified(); - const bool lhs_os_specified = TripleOSWasSpecified(); - // Both architectures had the OS specified, so if they aren't - // equal then we return false - if (rhs_os_specified && lhs_os_specified) - return false; + if (exact_match) + { + const bool rhs_os_specified = rhs.TripleOSWasSpecified(); + const bool lhs_os_specified = TripleOSWasSpecified(); + // Both architectures had the OS specified, so if they aren't + // equal then we return false + if (rhs_os_specified && lhs_os_specified) + return false; + } // Only fail if both os types are not unknown if (lhs_triple_os != llvm::Triple::UnknownOS && rhs_triple_os != llvm::Triple::UnknownOS) @@ -869,18 +875,6 @@ cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_in } bool -lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs) -{ - return lhs.IsExactMatch (rhs); -} - -bool -lldb_private::operator!= (const ArchSpec& lhs, const ArchSpec& rhs) -{ - return !(lhs == rhs); -} - -bool lldb_private::operator<(const ArchSpec& lhs, const ArchSpec& rhs) { const ArchSpec::Core lhs_core = lhs.GetCore (); |