14#ifndef LLVM_SUPPORT_VERSIONTUPLE_H
15#define LLVM_SUPPORT_VERSIONTUPLE_H
24template <
typename HasherT, llvm::endianness Endianness>
class HashBuilder;
33 unsigned HasMinor : 1;
35 unsigned Subminor : 31;
36 unsigned HasSubminor : 1;
39 unsigned HasBuild : 1;
43 : Major(0), Minor(0), HasMinor(
false), Subminor(0), HasSubminor(
false),
44 Build(0), HasBuild(
false) {}
47 : Major(Major), Minor(0), HasMinor(
false), Subminor(0),
48 HasSubminor(
false), Build(0), HasBuild(
false) {}
51 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(0),
52 HasSubminor(
false), Build(0), HasBuild(
false) {}
56 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
57 HasSubminor(
true), Build(0), HasBuild(
false) {}
60 unsigned Subminor,
unsigned Build)
61 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
62 HasSubminor(
true), Build(Build), HasBuild(
true) {}
67 return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0;
110 if (Result.Build == 0) {
111 Result.HasBuild =
false;
112 if (Result.Subminor == 0) {
113 Result.HasSubminor =
false;
114 if (Result.Minor == 0)
115 Result.HasMinor =
false;
124 return X.Major ==
Y.Major &&
X.Minor ==
Y.Minor &&
125 X.Subminor ==
Y.Subminor &&
X.Build ==
Y.Build;
141 return std::tie(
X.Major,
X.Minor,
X.Subminor,
X.Build) <
142 std::tie(
Y.Major,
Y.Minor,
Y.Subminor,
Y.Build);
172 return hash_combine(VT.Major, VT.Minor, VT.Subminor, VT.Build);
175 template <
typename HasherT, llvm::endianness Endianness>
178 HBuilder.
add(VT.Major, VT.Minor, VT.Subminor, VT.Build);
191raw_ostream &
operator<<(raw_ostream &Out,
const VersionTuple &V);
200 unsigned Result =
Value.getMajor();
201 if (
auto Minor =
Value.getMinor())
203 if (
auto Subminor =
Value.getSubminor())
205 if (
auto Build =
Value.getBuild())
This file defines DenseMapInfo traits for DenseMap.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
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.
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)
bool tryParse(StringRef string)
Try to parse the given string as a version number.
std::string getAsString() const
Retrieve a string representation of the version number.
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.
VersionTuple withMajorReplaced(unsigned NewMajor) const
Return a version tuple that contains a different major version but everything else is the same.
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.
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...