14#ifndef LLVM_SUPPORT_VERSIONTUPLE_H
15#define LLVM_SUPPORT_VERSIONTUPLE_H
26template <
typename HasherT, llvm::endianness Endianness>
class HashBuilder;
35 unsigned HasMinor : 1;
37 unsigned Subminor : 31;
38 unsigned HasSubminor : 1;
41 unsigned Subbuild : 10;
42 unsigned HasBuild : 1;
43 unsigned HasSubbuild : 1;
47 : Major(0), Minor(0), HasMinor(
false), Subminor(0), HasSubminor(
false),
48 Build(0), Subbuild(0), HasBuild(
false), HasSubbuild(
false) {}
51 : Major(Major), Minor(0), HasMinor(
false), Subminor(0),
52 HasSubminor(
false), Build(0), Subbuild(0), HasBuild(
false),
56 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(0),
57 HasSubminor(
false), Build(0), Subbuild(0), HasBuild(
false),
62 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
63 HasSubminor(
true), Build(0), Subbuild(0), HasBuild(
false),
67 unsigned Subminor,
unsigned Build)
68 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
69 HasSubminor(
true), Build(Build), Subbuild(0), HasBuild(
true),
73 unsigned Subminor,
unsigned Build,
75 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
76 HasSubminor(
true), Build(Build), Subbuild(Subbuild), HasBuild(
true),
79 std::tuple<unsigned, unsigned, unsigned, unsigned, unsigned>
asTuple()
const {
80 return {Major, Minor, Subminor, Build, Subbuild};
132 if (Result.Subbuild == 0) {
133 Result.HasSubbuild =
false;
134 if (Result.Build == 0) {
135 Result.HasBuild =
false;
136 if (Result.Subminor == 0) {
137 Result.HasSubminor =
false;
138 if (Result.Minor == 0)
139 Result.HasMinor =
false;
149 return X.asTuple() ==
Y.asTuple();
165 return X.asTuple() <
Y.asTuple();
195 return hash_combine(VT.Major, VT.Minor, VT.Subminor, VT.Build, VT.Subbuild);
198 template <
typename HasherT, llvm::endianness Endianness>
201 HBuilder.
add(VT.Major, VT.Minor, VT.Subminor, VT.Build, VT.Subbuild);
223 unsigned Result =
Value.getMajor();
224 if (
auto Minor =
Value.getMinor())
226 if (
auto Subminor =
Value.getSubminor())
228 if (
auto Build =
Value.getBuild())
230 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")
This file implements the C++20 <bit> header.
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.
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...