15 #ifndef LLVM_CLANG_BASIC_VERSIONTUPLE_H
16 #define LLVM_CLANG_BASIC_VERSIONTUPLE_H
19 #include "llvm/ADT/Optional.h"
29 unsigned Subminor : 31;
31 unsigned HasMinor : 1;
32 unsigned HasSubminor : 1;
33 unsigned HasBuild : 1;
34 unsigned UsesUnderscores : 1;
38 : Major(0), Minor(0), Subminor(0), Build(0), HasMinor(
false),
42 : Major(Major), Minor(0), Subminor(0), Build(0), HasMinor(
false),
46 bool UsesUnderscores =
false)
47 : Major(Major), Minor(Minor), Subminor(0), Build(0), HasMinor(
true),
48 HasSubminor(
false), HasBuild(
false), UsesUnderscores(UsesUnderscores) {}
50 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor,
51 bool UsesUnderscores =
false)
52 : Major(Major), Minor(Minor), Subminor(Subminor), Build(0),
54 UsesUnderscores(UsesUnderscores) {}
56 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor,
57 unsigned Build,
bool UsesUnderscores =
false)
58 : Major(Major), Minor(Minor), Subminor(Subminor), Build(Build),
60 UsesUnderscores(UsesUnderscores) {}
65 return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0;
93 return UsesUnderscores;
97 UsesUnderscores =
false;
103 return X.Major == Y.Major && X.Minor == Y.Minor &&
104 X.Subminor == Y.Subminor && X.Build == Y.Build;
120 return std::tie(X.Major, X.Minor, X.Subminor, X.Build) <
121 std::tie(Y.Major, Y.Minor, Y.Subminor, Y.Build);
160 raw_ostream&
operator<<(raw_ostream &Out,
const VersionTuple &V);
163 #endif // LLVM_CLANG_BASIC_VERSIONTUPLE_H
friend bool operator>(const VersionTuple &X, const VersionTuple &Y)
Determine whether one version number follows another.
Represents a version number in the form major[.minor[.subminor[.build]]].
bool usesUnderscores() const
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
VersionTuple(unsigned Major, unsigned Minor, bool UsesUnderscores=false)
std::string getAsString() const
Retrieve a string representation of the version number.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
VersionTuple(unsigned Major)
friend bool operator==(const VersionTuple &X, const VersionTuple &Y)
Determine if two version numbers are equivalent. If not provided, minor and subminor version numbers ...
VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, bool UsesUnderscores=false)
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 follows or is equivalent to another.
VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build, bool UsesUnderscores=false)
unsigned getMajor() const
Retrieve the major version number.
bool tryParse(StringRef string)
Try to parse the given string as a version number.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero)...
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
Optional< unsigned > getBuild() const
Retrieve the build version number, if provided.
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 precedes or is equivalent to another.