LLVM  15.0.0git
Public Member Functions | Friends | List of all members
llvm::VersionTuple Class Reference

Represents a version number in the form major[.minor[.subminor[.build]]]. More...

#include "llvm/Support/VersionTuple.h"

Public Member Functions

 VersionTuple ()
 
 VersionTuple (unsigned Major)
 
 VersionTuple (unsigned Major, unsigned Minor)
 
 VersionTuple (unsigned Major, unsigned Minor, unsigned Subminor)
 
 VersionTuple (unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build)
 
bool empty () const
 Determine whether this version information is empty (e.g., all version components are zero). More...
 
unsigned getMajor () const
 Retrieve the major version number. More...
 
Optional< unsigned > getMinor () const
 Retrieve the minor version number, if provided. More...
 
Optional< unsigned > getSubminor () const
 Retrieve the subminor version number, if provided. More...
 
Optional< unsigned > getBuild () const
 Retrieve the build version number, if provided. More...
 
VersionTuple withoutBuild () const
 Return a version tuple that contains only the first 3 version components. More...
 
VersionTuple withMajorReplaced (unsigned NewMajor) const
 Return a version tuple that contains a different major version but everything else is the same. More...
 
VersionTuple normalize () const
 Return a version tuple that contains only components that are non-zero. More...
 
std::string getAsString () const
 Retrieve a string representation of the version number. More...
 
bool tryParse (StringRef string)
 Try to parse the given string as a version number. More...
 

Friends

bool operator== (const VersionTuple &X, const VersionTuple &Y)
 Determine if two version numbers are equivalent. More...
 
bool operator!= (const VersionTuple &X, const VersionTuple &Y)
 Determine if two version numbers are not equivalent. More...
 
bool operator< (const VersionTuple &X, const VersionTuple &Y)
 Determine whether one version number precedes another. More...
 
bool operator> (const VersionTuple &X, const VersionTuple &Y)
 Determine whether one version number follows another. More...
 
bool operator<= (const VersionTuple &X, const VersionTuple &Y)
 Determine whether one version number precedes or is equivalent to another. More...
 
bool operator>= (const VersionTuple &X, const VersionTuple &Y)
 Determine whether one version number follows or is equivalent to another. More...
 
hash_code hash_value (const VersionTuple &VT)
 
template<typename HasherT , llvm::support::endianness Endianness>
void addHash (HashBuilderImpl< HasherT, Endianness > &HBuilder, const VersionTuple &VT)
 

Detailed Description

Represents a version number in the form major[.minor[.subminor[.build]]].

Definition at line 31 of file VersionTuple.h.

Constructor & Destructor Documentation

◆ VersionTuple() [1/5]

llvm::VersionTuple::VersionTuple ( )
inline

Definition at line 44 of file VersionTuple.h.

Referenced by tryParse(), withMajorReplaced(), and withoutBuild().

◆ VersionTuple() [2/5]

llvm::VersionTuple::VersionTuple ( unsigned  Major)
inlineexplicit

Definition at line 48 of file VersionTuple.h.

◆ VersionTuple() [3/5]

llvm::VersionTuple::VersionTuple ( unsigned  Major,
unsigned  Minor 
)
inlineexplicit

Definition at line 52 of file VersionTuple.h.

◆ VersionTuple() [4/5]

llvm::VersionTuple::VersionTuple ( unsigned  Major,
unsigned  Minor,
unsigned  Subminor 
)
inlineexplicit

Definition at line 56 of file VersionTuple.h.

◆ VersionTuple() [5/5]

llvm::VersionTuple::VersionTuple ( unsigned  Major,
unsigned  Minor,
unsigned  Subminor,
unsigned  Build 
)
inlineexplicit

Definition at line 60 of file VersionTuple.h.

Member Function Documentation

◆ empty()

bool llvm::VersionTuple::empty ( ) const
inline

Determine whether this version information is empty (e.g., all version components are zero).

Definition at line 67 of file VersionTuple.h.

Referenced by EmitSDKVersionSuffix(), getWindowsSDKDirViaCommandLine(), and targetVersionOrMinimumSupportedOSVersion().

◆ getAsString()

std::string VersionTuple::getAsString ( ) const

Retrieve a string representation of the version number.

Definition at line 21 of file VersionTuple.cpp.

Referenced by getWindowsSDKDirViaCommandLine().

◆ getBuild()

Optional<unsigned> llvm::VersionTuple::getBuild ( ) const
inline

Retrieve the build version number, if provided.

Definition at line 89 of file VersionTuple.h.

References llvm::None.

Referenced by llvm::operator<<().

◆ getMajor()

unsigned llvm::VersionTuple::getMajor ( ) const
inline

◆ getMinor()

Optional<unsigned> llvm::VersionTuple::getMinor ( ) const
inline

Retrieve the minor version number, if provided.

Definition at line 75 of file VersionTuple.h.

References llvm::None.

Referenced by emitDXILValidatorVersion(), EmitSDKVersionSuffix(), and llvm::operator<<().

◆ getSubminor()

Optional<unsigned> llvm::VersionTuple::getSubminor ( ) const
inline

Retrieve the subminor version number, if provided.

Definition at line 82 of file VersionTuple.h.

References llvm::None.

Referenced by EmitSDKVersionSuffix(), and llvm::operator<<().

◆ normalize()

VersionTuple llvm::VersionTuple::normalize ( ) const
inline

Return a version tuple that contains only components that are non-zero.

Definition at line 109 of file VersionTuple.h.

◆ tryParse()

bool VersionTuple::tryParse ( StringRef  string)

Try to parse the given string as a version number.

Returns
true if the string does not match the regular expression [0-9]+(.[0-9]+){0,3}

Definition at line 63 of file VersionTuple.cpp.

References llvm::irsymtab::build(), input, parseInt(), and VersionTuple().

Referenced by getHighestNumericTupleInDirectory(), and getWindowsSDKDirViaCommandLine().

◆ withMajorReplaced()

VersionTuple llvm::VersionTuple::withMajorReplaced ( unsigned  NewMajor) const
inline

Return a version tuple that contains a different major version but everything else is the same.

Definition at line 104 of file VersionTuple.h.

References VersionTuple().

◆ withoutBuild()

VersionTuple llvm::VersionTuple::withoutBuild ( ) const
inline

Return a version tuple that contains only the first 3 version components.

Definition at line 96 of file VersionTuple.h.

References VersionTuple().

Friends And Related Function Documentation

◆ addHash

template<typename HasherT , llvm::support::endianness Endianness>
void addHash ( HashBuilderImpl< HasherT, Endianness > &  HBuilder,
const VersionTuple VT 
)
friend

Definition at line 177 of file VersionTuple.h.

◆ hash_value

hash_code hash_value ( const VersionTuple VT)
friend

Definition at line 172 of file VersionTuple.h.

◆ operator!=

bool operator!= ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine if two version numbers are not equivalent.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 133 of file VersionTuple.h.

◆ operator<

bool operator< ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine whether one version number precedes another.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 141 of file VersionTuple.h.

◆ operator<=

bool operator<= ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine whether one version number precedes or is equivalent to another.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 159 of file VersionTuple.h.

◆ operator==

bool operator== ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine if two version numbers are equivalent.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 124 of file VersionTuple.h.

◆ operator>

bool operator> ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine whether one version number follows another.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 150 of file VersionTuple.h.

◆ operator>=

bool operator>= ( const VersionTuple X,
const VersionTuple Y 
)
friend

Determine whether one version number follows or is equivalent to another.

If not provided, minor and subminor version numbers are considered to be zero.

Definition at line 168 of file VersionTuple.h.


The documentation for this class was generated from the following files: