friss created this revision. friss added a reviewer: aprantl. Herald added subscribers: dexonsmith, inglorion. Herald added a project: LLDB.
Initially, Apple simulator binarie triples didn't use a `-simulator` environment and were just differentiated based on the architecture. For example, `x86_64-apple-ios` would obviously be a simualtor as iOS doesn't run on x86_64. With Catalyst, we made the disctinction explicit and today, all simulator triples (even the legacy ones) are constructed with an environment. This is especially important on Apple Silicon were the architecture is not different from the one of the simulated device. This change makes the simulator part of the environment always part of the criteria to detect whether 2 `ArchSpec`s are equal or compatible. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D84716 Files: lldb/source/Utility/ArchSpec.cpp lldb/unittests/Utility/ArchSpecTest.cpp Index: lldb/unittests/Utility/ArchSpecTest.cpp =================================================================== --- lldb/unittests/Utility/ArchSpecTest.cpp +++ lldb/unittests/Utility/ArchSpecTest.cpp @@ -314,6 +314,14 @@ // this is the desired behavior. ASSERT_FALSE(A.IsCompatibleMatch(B)); } + { + ArchSpec A("arm64-apple-ios"); + ArchSpec B("arm64-apple-ios-simulator"); + ASSERT_FALSE(A.IsExactMatch(B)); + ASSERT_FALSE(A.IsCompatibleMatch(B)); + ASSERT_FALSE(B.IsCompatibleMatch(A)); + ASSERT_FALSE(B.IsCompatibleMatch(A)); + } { ArchSpec A("x86_64-*-*"); ArchSpec B("x86_64-apple-ios-simulator"); Index: lldb/source/Utility/ArchSpec.cpp =================================================================== --- lldb/source/Utility/ArchSpec.cpp +++ lldb/source/Utility/ArchSpec.cpp @@ -987,6 +987,12 @@ if (lhs == rhs) return true; + // Apple simulators are a different platform than what they simulate. + // As the environments are different at this point, if one of them is a + // simulator, then they are different. + if (lhs == llvm::Triple::Simulator || rhs == llvm::Triple::Simulator) + return false; + // If any of the environment is unknown then they are compatible if (lhs == llvm::Triple::UnknownEnvironment || rhs == llvm::Triple::UnknownEnvironment)
Index: lldb/unittests/Utility/ArchSpecTest.cpp =================================================================== --- lldb/unittests/Utility/ArchSpecTest.cpp +++ lldb/unittests/Utility/ArchSpecTest.cpp @@ -314,6 +314,14 @@ // this is the desired behavior. ASSERT_FALSE(A.IsCompatibleMatch(B)); } + { + ArchSpec A("arm64-apple-ios"); + ArchSpec B("arm64-apple-ios-simulator"); + ASSERT_FALSE(A.IsExactMatch(B)); + ASSERT_FALSE(A.IsCompatibleMatch(B)); + ASSERT_FALSE(B.IsCompatibleMatch(A)); + ASSERT_FALSE(B.IsCompatibleMatch(A)); + } { ArchSpec A("x86_64-*-*"); ArchSpec B("x86_64-apple-ios-simulator"); Index: lldb/source/Utility/ArchSpec.cpp =================================================================== --- lldb/source/Utility/ArchSpec.cpp +++ lldb/source/Utility/ArchSpec.cpp @@ -987,6 +987,12 @@ if (lhs == rhs) return true; + // Apple simulators are a different platform than what they simulate. + // As the environments are different at this point, if one of them is a + // simulator, then they are different. + if (lhs == llvm::Triple::Simulator || rhs == llvm::Triple::Simulator) + return false; + // If any of the environment is unknown then they are compatible if (lhs == llvm::Triple::UnknownEnvironment || rhs == llvm::Triple::UnknownEnvironment)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits