mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[clang][darwin] Add support for macOS -> Mac Catalyst
version remapping to the Darwin SDK Info Differential Revision: https://reviews.llvm.org/D105958
This commit is contained in:
parent
8dc35a0179
commit
e6cc4def5d
@ -14,6 +14,7 @@
|
||||
#ifndef LLVM_SUPPORT_VERSIONTUPLE_H
|
||||
#define LLVM_SUPPORT_VERSIONTUPLE_H
|
||||
|
||||
#include "llvm/ADT/DenseMapInfo.h"
|
||||
#include "llvm/ADT/Hashing.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include <string>
|
||||
@ -95,6 +96,20 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Return a version tuple that contains only components that are non-zero.
|
||||
VersionTuple normalize() const {
|
||||
VersionTuple Result = *this;
|
||||
if (Result.Build == 0) {
|
||||
Result.HasBuild = false;
|
||||
if (Result.Subminor == 0) {
|
||||
Result.HasSubminor = false;
|
||||
if (Result.Minor == 0)
|
||||
Result.HasMinor = false;
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// Determine if two version numbers are equivalent. If not
|
||||
/// provided, minor and subminor version numbers are considered to be zero.
|
||||
friend bool operator==(const VersionTuple &X, const VersionTuple &Y) {
|
||||
@ -161,5 +176,28 @@ public:
|
||||
/// Print a version number.
|
||||
raw_ostream &operator<<(raw_ostream &Out, const VersionTuple &V);
|
||||
|
||||
// Provide DenseMapInfo for version tuples.
|
||||
template <> struct DenseMapInfo<VersionTuple> {
|
||||
static inline VersionTuple getEmptyKey() { return VersionTuple(0x7FFFFFFF); }
|
||||
static inline VersionTuple getTombstoneKey() {
|
||||
return VersionTuple(0x7FFFFFFE);
|
||||
}
|
||||
static unsigned getHashValue(const VersionTuple &Value) {
|
||||
unsigned Result = Value.getMajor();
|
||||
if (auto Minor = Value.getMinor())
|
||||
Result = detail::combineHashValue(Result, *Minor);
|
||||
if (auto Subminor = Value.getSubminor())
|
||||
Result = detail::combineHashValue(Result, *Subminor);
|
||||
if (auto Build = Value.getBuild())
|
||||
Result = detail::combineHashValue(Result, *Build);
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
static bool isEqual(const VersionTuple &LHS, const VersionTuple &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
#endif // LLVM_SUPPORT_VERSIONTUPLE_H
|
||||
|
Loading…
Reference in New Issue
Block a user