[llvm] f991f30 - [llvm][TextAPI] compare deployment versions for equality check
Cyndy Ishida via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 16:55:51 PDT 2023
Author: Cyndy Ishida
Date: 2023-03-31T16:50:08-07:00
New Revision: f991f30845bb464a1a8e240b3512bac0258417db
URL: https://github.com/llvm/llvm-project/commit/f991f30845bb464a1a8e240b3512bac0258417db
DIFF: https://github.com/llvm/llvm-project/commit/f991f30845bb464a1a8e240b3512bac0258417db.diff
LOG: [llvm][TextAPI] compare deployment versions for equality check
Added:
Modified:
llvm/include/llvm/TextAPI/Target.h
llvm/unittests/TextAPI/TextStubV5Tests.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/TextAPI/Target.h b/llvm/include/llvm/TextAPI/Target.h
index 0ab2783fc60c5..87895a9e412f3 100644
--- a/llvm/include/llvm/TextAPI/Target.h
+++ b/llvm/include/llvm/TextAPI/Target.h
@@ -45,15 +45,21 @@ class Target {
};
inline bool operator==(const Target &LHS, const Target &RHS) {
- return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
+ bool CrossLinkMatch =
+ std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
+ // Ignore potential mismatches due to missing deployment versions.
+ if (LHS.MinDeployment.empty() || RHS.MinDeployment.empty())
+ return CrossLinkMatch;
+ return CrossLinkMatch && LHS.MinDeployment == RHS.MinDeployment;
}
inline bool operator!=(const Target &LHS, const Target &RHS) {
- return std::tie(LHS.Arch, LHS.Platform) != std::tie(RHS.Arch, RHS.Platform);
+ return !(LHS == RHS);
}
inline bool operator<(const Target &LHS, const Target &RHS) {
- return std::tie(LHS.Arch, LHS.Platform) < std::tie(RHS.Arch, RHS.Platform);
+ return std::tie(LHS.Arch, LHS.Platform, LHS.MinDeployment) <
+ std::tie(RHS.Arch, RHS.Platform, RHS.MinDeployment);
}
inline bool operator==(const Target &LHS, const Architecture &RHS) {
diff --git a/llvm/unittests/TextAPI/TextStubV5Tests.cpp b/llvm/unittests/TextAPI/TextStubV5Tests.cpp
index b4e8f513daee2..5f8d3de991d0d 100644
--- a/llvm/unittests/TextAPI/TextStubV5Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV5Tests.cpp
@@ -192,8 +192,8 @@ TEST(TBDv5, ReadFile) {
TargetList AllTargets = {
Target(AK_x86_64, PLATFORM_MACOS, VersionTuple(10, 14)),
- Target(AK_arm64, PLATFORM_MACOS, VersionTuple(10, 14)),
- Target(AK_arm64, PLATFORM_MACCATALYST, VersionTuple(12, 1)),
+ Target(AK_arm64, PLATFORM_MACOS, VersionTuple(11, 0, 0)),
+ Target(AK_arm64, PLATFORM_MACCATALYST, VersionTuple(14, 0)),
};
EXPECT_EQ(mapToPlatformSet(AllTargets), File->getPlatforms());
EXPECT_EQ(mapToArchitectureSet(AllTargets), File->getArchitectures());
@@ -926,7 +926,7 @@ TEST(TBDv5, Target_Simulator) {
EXPECT_EQ(FileType::TBD_V5, File->getFileType());
TargetList ExpectedTargets = {
Target(AK_x86_64, PLATFORM_IOSSIMULATOR, VersionTuple(11, 3)),
- Target(AK_arm64, PLATFORM_IOSSIMULATOR, VersionTuple(11, 0)),
+ Target(AK_arm64, PLATFORM_IOSSIMULATOR, VersionTuple(14, 0)),
};
TargetList Targets{File->targets().begin(), File->targets().end()};
llvm::sort(Targets);
More information about the llvm-commits
mailing list