forked from OSchip/llvm-project
[lldb] Convert internal platform usages GetSupportedArchitectures
This commit is contained in:
parent
cc505c0bb7
commit
3a56f5622f
|
@ -844,9 +844,8 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
|
||||||
// architectures that we should be using (in the correct order) and see
|
// architectures that we should be using (in the correct order) and see
|
||||||
// if we can find a match that way
|
// if we can find a match that way
|
||||||
ModuleSpec arch_module_spec(module_spec);
|
ModuleSpec arch_module_spec(module_spec);
|
||||||
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
|
for (const ArchSpec &arch : GetSupportedArchitectures()) {
|
||||||
idx, arch_module_spec.GetArchitecture());
|
arch_module_spec.GetArchitecture() = arch;
|
||||||
++idx) {
|
|
||||||
error = ModuleList::GetSharedModule(arch_module_spec, exe_module_sp,
|
error = ModuleList::GetSharedModule(arch_module_spec, exe_module_sp,
|
||||||
module_search_paths_ptr, nullptr,
|
module_search_paths_ptr, nullptr,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
@ -891,9 +890,9 @@ Platform::ResolveRemoteExecutable(const ModuleSpec &module_spec,
|
||||||
// ask the platform for the architectures that we should be using (in the
|
// ask the platform for the architectures that we should be using (in the
|
||||||
// correct order) and see if we can find a match that way
|
// correct order) and see if we can find a match that way
|
||||||
StreamString arch_names;
|
StreamString arch_names;
|
||||||
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
|
llvm::ListSeparator LS;
|
||||||
idx, resolved_module_spec.GetArchitecture());
|
for (const ArchSpec &arch : GetSupportedArchitectures()) {
|
||||||
++idx) {
|
resolved_module_spec.GetArchitecture() = arch;
|
||||||
error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
|
error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
|
||||||
module_search_paths_ptr, nullptr,
|
module_search_paths_ptr, nullptr,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
@ -905,10 +904,7 @@ Platform::ResolveRemoteExecutable(const ModuleSpec &module_spec,
|
||||||
error.SetErrorToGenericError();
|
error.SetErrorToGenericError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx > 0)
|
arch_names << LS << arch.GetArchitectureName();
|
||||||
arch_names.PutCString(", ");
|
|
||||||
arch_names.PutCString(
|
|
||||||
resolved_module_spec.GetArchitecture().GetArchitectureName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.Fail() || !exe_module_sp) {
|
if (error.Fail() || !exe_module_sp) {
|
||||||
|
@ -1250,26 +1246,13 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch,
|
||||||
// If the architecture is invalid, we must answer true...
|
// If the architecture is invalid, we must answer true...
|
||||||
if (arch.IsValid()) {
|
if (arch.IsValid()) {
|
||||||
ArchSpec platform_arch;
|
ArchSpec platform_arch;
|
||||||
// Try for an exact architecture match first.
|
auto match = exact_arch_match ? &ArchSpec::IsExactMatch
|
||||||
if (exact_arch_match) {
|
: &ArchSpec::IsCompatibleMatch;
|
||||||
for (uint32_t arch_idx = 0;
|
for (const ArchSpec &platform_arch : GetSupportedArchitectures()) {
|
||||||
GetSupportedArchitectureAtIndex(arch_idx, platform_arch);
|
if ((arch.*match)(platform_arch)) {
|
||||||
++arch_idx) {
|
if (compatible_arch_ptr)
|
||||||
if (arch.IsExactMatch(platform_arch)) {
|
*compatible_arch_ptr = platform_arch;
|
||||||
if (compatible_arch_ptr)
|
return true;
|
||||||
*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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1630,9 +1613,8 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
|
||||||
// architectures that we should be using (in the correct order) and see if
|
// architectures that we should be using (in the correct order) and see if
|
||||||
// we can find a match that way
|
// we can find a match that way
|
||||||
ModuleSpec arch_module_spec(module_spec);
|
ModuleSpec arch_module_spec(module_spec);
|
||||||
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
|
for (const ArchSpec &arch : GetSupportedArchitectures()) {
|
||||||
idx, arch_module_spec.GetArchitecture());
|
arch_module_spec.GetArchitecture() = arch;
|
||||||
++idx) {
|
|
||||||
error = ModuleList::GetSharedModule(arch_module_spec, module_sp, nullptr,
|
error = ModuleList::GetSharedModule(arch_module_spec, module_sp, nullptr,
|
||||||
nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
// Did we find an executable using one of the
|
// Did we find an executable using one of the
|
||||||
|
|
Loading…
Reference in New Issue