namespace MachO {
using PlatformSet = SmallSet<PlatformType, 3>;
+using PlatformVersionSet = SmallSet<std::pair<PlatformType, VersionTuple>, 3>;
PlatformType mapToPlatformType(PlatformType Platform, bool WantSim);
PlatformType mapToPlatformType(const Triple &Target);
};
inline bool operator==(const Target &LHS, const Target &RHS) {
- 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;
+ // In most cases the deployment version is not useful to compare.
+ return std::tie(LHS.Arch, LHS.Platform) == std::tie(RHS.Arch, RHS.Platform);
}
inline bool operator!=(const Target &LHS, const Target &RHS) {
return LHS.Arch != RHS;
}
+PlatformVersionSet mapToPlatformVersionSet(ArrayRef<Target> Targets);
PlatformSet mapToPlatformSet(ArrayRef<Target> Targets);
ArchitectureSet mapToArchitectureSet(ArrayRef<Target> Targets);
if (!(isYAMLTextStub(FileKind)) && !(isYAMLTextStub(O.FileKind))) {
if (RPaths != O.RPaths)
return false;
+ if (mapToPlatformVersionSet(Targets) != mapToPlatformVersionSet(O.Targets))
+ return false;
}
if (!std::equal(Documents.begin(), Documents.end(), O.Documents.begin(),
return OS;
}
+PlatformVersionSet mapToPlatformVersionSet(ArrayRef<Target> Targets) {
+ PlatformVersionSet Result;
+ for (const auto &Target : Targets)
+ Result.insert({Target.Platform, Target.MinDeployment});
+ return Result;
+}
+
PlatformSet mapToPlatformSet(ArrayRef<Target> Targets) {
PlatformSet Result;
for (const auto &Target : Targets)
#include "llvm/TextAPI/InterfaceFile.h"
#include "llvm/TextAPI/Symbol.h"
#include "llvm/TextAPI/Target.h"
+#include <iterator>
using namespace llvm;
using namespace MachO;
bool checkSymbolEquality(llvm::MachO::InterfaceFile::const_symbol_range LHS,
llvm::MachO::InterfaceFile::const_symbol_range RHS) {
+ if (std::distance(LHS.begin(), LHS.end()) !=
+ std::distance(RHS.begin(), RHS.end()))
+ return false;
return std::equal(LHS.begin(), LHS.end(), RHS.begin(),
[&](auto LHS, auto RHS) { return *LHS == *RHS; });
}