本文整理汇总了C++中ArchSpec::IsExactMatch方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchSpec::IsExactMatch方法的具体用法?C++ ArchSpec::IsExactMatch怎么用?C++ ArchSpec::IsExactMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArchSpec
的用法示例。
在下文中一共展示了ArchSpec::IsExactMatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: module_sp
ObjectFileSP
ObjectContainerUniversalMachO::GetObjectFile(const FileSpec *file) {
uint32_t arch_idx = 0;
ArchSpec arch;
// If the module hasn't specified an architecture yet, set it to the default
// architecture:
ModuleSP module_sp(GetModule());
if (module_sp) {
if (!module_sp->GetArchitecture().IsValid()) {
arch = Target::GetDefaultArchitecture();
if (!arch.IsValid())
arch.SetTriple(LLDB_ARCH_DEFAULT);
} else
arch = module_sp->GetArchitecture();
ArchSpec curr_arch;
// First, try to find an exact match for the Arch of the Target.
for (arch_idx = 0; arch_idx < m_header.nfat_arch; ++arch_idx) {
if (GetArchitectureAtIndex(arch_idx, curr_arch) &&
arch.IsExactMatch(curr_arch))
break;
}
// Failing an exact match, try to find a compatible Arch of the Target.
if (arch_idx >= m_header.nfat_arch) {
for (arch_idx = 0; arch_idx < m_header.nfat_arch; ++arch_idx) {
if (GetArchitectureAtIndex(arch_idx, curr_arch) &&
arch.IsCompatibleMatch(curr_arch))
break;
}
}
if (arch_idx < m_header.nfat_arch) {
DataBufferSP data_sp;
lldb::offset_t data_offset = 0;
return ObjectFile::FindPlugin(
module_sp, file, m_offset + m_fat_archs[arch_idx].offset,
m_fat_archs[arch_idx].size, data_sp, data_offset);
}
}
return ObjectFileSP();
}
示例2:
//------------------------------------------------------------------
/// Lets a platform answer if it is compatible with a given
/// architecture and the target triple contained within.
//------------------------------------------------------------------
bool
Platform::IsCompatibleArchitecture (const ArchSpec &arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr)
{
// If the architecture is invalid, we must answer true...
if (arch.IsValid())
{
ArchSpec platform_arch;
// Try for an exact architecture match first.
if (exact_arch_match)
{
for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
{
if (arch.IsExactMatch(platform_arch))
{
if (compatible_arch_ptr)
*compatible_arch_ptr = platform_arch;
return true;
}
}
}
else
{
for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
{
if (arch.IsCompatibleMatch(platform_arch))
{
if (compatible_arch_ptr)
*compatible_arch_ptr = platform_arch;
return true;
}
}
}
}
if (compatible_arch_ptr)
compatible_arch_ptr->Clear();
return false;
}
示例3:
bool
lldb_private::operator== (const ArchSpec& lhs, const ArchSpec& rhs)
{
return lhs.IsExactMatch (rhs);
}