14#ifndef LLVM_SUPPORT_VERSIONTUPLE_H
15#define LLVM_SUPPORT_VERSIONTUPLE_H
25template <
typename HasherT, llvm::endianness Endianness>
class HashBuilder;
34 unsigned HasMinor : 1;
36 unsigned Subminor : 31;
37 unsigned HasSubminor : 1;
40 unsigned Subbuild : 10;
41 unsigned HasBuild : 1;
42 unsigned HasSubbuild : 1;
46 : Major(0), Minor(0), HasMinor(
false), Subminor(0), HasSubminor(
false),
47 Build(0), Subbuild(0), HasBuild(
false), HasSubbuild(
false) {}
50 : Major(Major), Minor(0), HasMinor(
false), Subminor(0),
51 HasSubminor(
false), Build(0), Subbuild(0), HasBuild(
false),
55 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(0),
56 HasSubminor(
false), Build(0), Subbuild(0), HasBuild(
false),
61 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
62 HasSubminor(
true), Build(0), Subbuild(0), HasBuild(
false),
66 unsigned Subminor,
unsigned Build)
67 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
68 HasSubminor(
true), Build(Build), Subbuild(0), HasBuild(
true),
72 unsigned Subminor,
unsigned Build,
74 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
75 HasSubminor(
true), Build(Build), Subbuild(Subbuild), HasBuild(
true),
78 std::tuple<unsigned, unsigned, unsigned, unsigned, unsigned>
asTuple()
const {
79 return {Major, Minor, Subminor, Build, Subbuild};
131 if (Result.Subbuild == 0) {
132 Result.HasSubbuild =
false;
133 if (Result.Build == 0) {
134 Result.HasBuild =
false;
135 if (Result.Subminor == 0) {
136 Result.HasSubminor =
false;
137 if (Result.Minor == 0)
138 Result.HasMinor =
false;
148 return X.asTuple() ==
Y.asTuple();
164 return X.asTuple() <
Y.asTuple();
194 return hash_combine(VT.Major, VT.Minor, VT.Subminor, VT.Build, VT.Subbuild);
197 template <
typename HasherT, llvm::endianness Endianness>
200 HBuilder.
add(VT.Major, VT.Minor, VT.Subminor, VT.Build, VT.Subbuild);
222 unsigned Result =
Value.getMajor();
223 if (
auto Minor =
Value.getMinor())
225 if (
auto Subminor =
Value.getSubminor())
227 if (
auto Build =
Value.getBuild())
229 if (
auto Subbuild =
Value.getSubbuild())
This file defines DenseMapInfo traits for DenseMap.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Interface to help hash various types through a hasher type.
std::enable_if_t< hashbuilder_detail::IsHashableData< T >::value, HashBuilder & > add(T Value)
Implement hashing for hashable data types, e.g. integral or enum values.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
Represents a version number in the form major[.minor[.subminor[.build]]].
constexpr VersionTuple(unsigned Major)
friend bool operator<=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes or is equivalent to another.
std::optional< unsigned > getBuild() const
Retrieve the build version number, if provided.
constexpr VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build)
constexpr VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor)
friend bool operator!=(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are not equivalent.
std::tuple< unsigned, unsigned, unsigned, unsigned, unsigned > asTuple() const
friend bool operator<(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes another.
friend bool operator>=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows or is equivalent to another.
constexpr VersionTuple(unsigned Major, unsigned Minor)
unsigned getMajor() const
Retrieve the major version number.
friend hash_code hash_value(const VersionTuple &VT)
LLVM_ABI bool tryParse(StringRef string)
Try to parse the given string as a version number.
constexpr VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build, unsigned Subbuild)
std::optional< unsigned > getSubbuild() const
Retrieve the subbuild version number, if provided.
LLVM_ABI std::string getAsString() const
Retrieve a string representation of the version number.
LLVM_ABI VersionTuple withMajorReplaced(unsigned NewMajor) const
Return a version tuple that contains a different major version but everything else is the same.
VersionTuple normalize() const
Return a version tuple that contains only components that are non-zero.
std::optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
VersionTuple withoutBuild() const
Return a version tuple that contains only the first 3 version components.
friend bool operator==(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are equivalent.
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
friend bool operator>(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows another.
friend void addHash(HashBuilder< HasherT, Endianness > &HBuilder, const VersionTuple &VT)
An opaque object representing a hash code.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
static VersionTuple getEmptyKey()
static bool isEqual(const VersionTuple &LHS, const VersionTuple &RHS)
static VersionTuple getTombstoneKey()
static unsigned getHashValue(const VersionTuple &Value)
An information struct used to provide DenseMap with the various necessary components for a given valu...