Go to the documentation of this file.
14 #ifndef LLVM_SUPPORT_VERSIONTUPLE_H
15 #define LLVM_SUPPORT_VERSIONTUPLE_H
25 template <
typename HasherT, support::endianness Endianness>
26 class HashBuilderImpl;
35 unsigned HasMinor : 1;
37 unsigned Subminor : 31;
38 unsigned HasSubminor : 1;
41 unsigned HasBuild : 1;
45 : Major(0), Minor(0), HasMinor(
false), Subminor(0), HasSubminor(
false),
46 Build(0), HasBuild(
false) {}
49 : Major(Major), Minor(0), HasMinor(
false), Subminor(0),
50 HasSubminor(
false), Build(0), HasBuild(
false) {}
53 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(0),
54 HasSubminor(
false), Build(0), HasBuild(
false) {}
56 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor)
57 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
58 HasSubminor(
true), Build(0), HasBuild(
false) {}
60 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor,
62 : Major(Major), Minor(Minor), HasMinor(
true), Subminor(Subminor),
63 HasSubminor(
true), Build(Build), HasBuild(
true) {}
68 return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0;
111 if (Result.Build == 0) {
112 Result.HasBuild =
false;
113 if (Result.Subminor == 0) {
114 Result.HasSubminor =
false;
115 if (Result.Minor == 0)
116 Result.HasMinor =
false;
125 return X.Major ==
Y.Major &&
X.Minor ==
Y.Minor &&
126 X.Subminor ==
Y.Subminor &&
X.Build ==
Y.Build;
142 return std::tie(
X.Major,
X.Minor,
X.Subminor,
X.Build) <
143 std::tie(
Y.Major,
Y.Minor,
Y.Subminor,
Y.Build);
173 return hash_combine(VT.Major, VT.Minor, VT.Subminor, VT.Build);
176 template <
typename HasherT, llvm::support::endianness Endianness>
179 HBuilder.
add(VT.Major, VT.Minor, VT.Subminor, VT.Build);
192 raw_ostream &
operator<<(raw_ostream &Out,
const VersionTuple &V);
201 unsigned Result =
Value.getMajor();
202 if (
auto Minor =
Value.getMinor())
204 if (
auto Subminor =
Value.getSubminor())
206 if (
auto Build =
Value.getBuild())
218 #endif // LLVM_SUPPORT_VERSIONTUPLE_H
This is an optimization pass for GlobalISel generic memory operations.
friend bool operator>=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows or is equivalent to another.
bool tryParse(StringRef string)
Try to parse the given string as a version number.
friend bool operator<=(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes or is equivalent to another.
friend bool operator!=(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are not equivalent.
VersionTuple(unsigned Major)
VersionTuple withoutBuild() const
Return a version tuple that contains only the first 3 version components.
unsigned getMajor() const
Retrieve the major version number.
VersionTuple withMajorReplaced(unsigned NewMajor) const
Return a version tuple that contains a different major version but everything else is the same.
An information struct used to provide DenseMap with the various necessary components for a given valu...
friend void addHash(HashBuilderImpl< HasherT, Endianness > &HBuilder, const VersionTuple &VT)
static VersionTuple getEmptyKey()
friend bool operator>(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows another.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
std::enable_if_t< hashbuilder_detail::IsHashableData< T >::value, HashBuilderImpl & > add(T Value)
Implement hashing for hashable data types, e.g. integral or enum values.
Represents a version number in the form major[.minor[.subminor[.build]]].
VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build)
static unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static bool isEqual(const VersionTuple &LHS, const VersionTuple &RHS)
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
VersionTuple normalize() const
Return a version tuple that contains only components that are non-zero.
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
VersionTuple(unsigned Major, unsigned Minor)
Optional< unsigned > getBuild() const
Retrieve the build version number, if provided.
Implementation of the HashBuilder interface.
friend bool operator==(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are equivalent.
StringRef - Represent a constant reference to a string, i.e.
std::string getAsString() const
Retrieve a string representation of the version number.
static VersionTuple getTombstoneKey()
static unsigned getHashValue(const VersionTuple &Value)
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
friend bool operator<(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number precedes another.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor)
friend hash_code hash_value(const VersionTuple &VT)
LLVM Value Representation.
An opaque object representing a hash code.