Skip to content

Commit cd7a2bf

Browse files
committed
[lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex
Don't set the OS when computing supported architectures in PlatformDarwin::ARMGetSupportedArchitectureAtIndex. Differential revision: https://reviews.llvm.org/D113159
1 parent 0a5c26f commit cd7a2bf

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,15 @@ static llvm::ArrayRef<const char *> GetCompatibleArchs(ArchSpec::Core core) {
559559
switch (core) {
560560
default:
561561
LLVM_FALLTHROUGH;
562+
case ArchSpec::eCore_arm_arm64e: {
563+
static const char *g_arm64e_compatible_archs[] = {
564+
"arm64e", "arm64", "armv7", "armv7f", "armv7k", "armv7s",
565+
"armv7m", "armv7em", "armv6m", "armv6", "armv5", "armv4",
566+
"arm", "thumbv7", "thumbv7f", "thumbv7k", "thumbv7s", "thumbv7m",
567+
"thumbv7em", "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
568+
};
569+
return {g_arm64e_compatible_archs};
570+
}
562571
case ArchSpec::eCore_arm_arm64: {
563572
static const char *g_arm64_compatible_archs[] = {
564573
"arm64", "armv7", "armv7f", "armv7k", "armv7s", "armv7m",
@@ -654,38 +663,15 @@ const char *PlatformDarwin::GetCompatibleArch(ArchSpec::Core core, size_t idx) {
654663
/// processor.
655664
bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx,
656665
ArchSpec &arch) {
657-
#if TARGET_OS_OSX
658-
if (IsHost()) {
659-
if (idx == 0) {
660-
arch.SetTriple("arm64e-apple-macosx");
661-
return true;
662-
} else if (idx == 1) {
663-
arch.SetTriple("arm64-apple-macosx");
664-
return true;
665-
}
666-
arch.Clear();
667-
return false;
668-
}
669-
#endif
670-
671-
#if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
672-
#define OSNAME "tvos"
673-
#elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
674-
#define OSNAME "watchos"
675-
#elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
676-
#define OSNAME "bridgeos"
677-
#elif defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1
678-
#define OSNAME "macosx"
679-
#else
680-
#define OSNAME "ios"
681-
#endif
682-
683666
const ArchSpec system_arch = GetSystemArchitecture();
684667
const ArchSpec::Core system_core = system_arch.GetCore();
668+
685669
if (const char *compatible_arch = GetCompatibleArch(system_core, idx)) {
686-
std::string triple =
687-
llvm::formatv("{0}-apple-" OSNAME, compatible_arch).str();
670+
llvm::Triple triple;
671+
triple.setArchName(compatible_arch);
672+
triple.setVendor(llvm::Triple::VendorType::Apple);
688673
arch.SetTriple(triple);
674+
return true;
689675
}
690676

691677
arch.Clear();

0 commit comments

Comments
 (0)