15 #ifndef LLVM_CLANG_BASIC_VERSIONTUPLE_H
16 #define LLVM_CLANG_BASIC_VERSIONTUPLE_H
19 #include "llvm/ADT/Optional.h"
29 unsigned UsesUnderscores : 1;
32 unsigned HasMinor : 1;
34 unsigned Subminor : 31;
35 unsigned HasSubminor : 1;
38 unsigned HasBuild : 1;
42 : Major(0), UsesUnderscores(
false), Minor(0), HasMinor(
false),
43 Subminor(0), HasSubminor(
false), Build(0), HasBuild(
false) {}
46 : Major(Major), UsesUnderscores(
false), Minor(0), HasMinor(
false),
47 Subminor(0), HasSubminor(
false), Build(0), HasBuild(
false) {}
50 bool UsesUnderscores =
false)
51 : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
52 HasMinor(
true), Subminor(0), HasSubminor(
false), Build(0),
55 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor,
56 bool UsesUnderscores =
false)
57 : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
58 HasMinor(
true), Subminor(Subminor), HasSubminor(
true), Build(0),
61 explicit VersionTuple(
unsigned Major,
unsigned Minor,
unsigned Subminor,
62 unsigned Build,
bool UsesUnderscores =
false)
63 : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
64 HasMinor(
true), Subminor(Subminor), HasSubminor(
true), Build(Build),
70 return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0;
98 return UsesUnderscores;
102 UsesUnderscores =
false;
108 return X.Major == Y.Major && X.Minor == Y.Minor &&
109 X.Subminor == Y.Subminor && X.Build == Y.Build;
125 return std::tie(X.Major, X.Minor, X.Subminor, X.Build) <
126 std::tie(Y.Major, Y.Minor, Y.Subminor, Y.Build);
165 raw_ostream&
operator<<(raw_ostream &Out,
const VersionTuple &V);
168 #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.
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.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
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.