LLVM: lib/Support/VersionTuple.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

17#include

18

19using namespace llvm;

20

22 std::string Result;

23 {

25 Out << *this;

26 }

27 return Result;

28}

29

31 Out << V.getMajor();

32 if (std::optional Minor = V.getMinor())

33 Out << '.' << *Minor;

34 if (std::optional Subminor = V.getSubminor())

35 Out << '.' << *Subminor;

36 if (std::optional Build = V.getBuild())

37 Out << '.' << *Build;

38 return Out;

39}

40

43 if (input.empty())

44 return true;

45

46 char next = input[0];

47 input = input.substr(1);

48 if (next < '0' || next > '9')

49 return true;

50 value = (unsigned)(next - '0');

51

52 while (!input.empty()) {

53 next = input[0];

54 if (next < '0' || next > '9')

55 return false;

56 input = input.substr(1);

57 value = value * 10 + (unsigned)(next - '0');

58 }

59

60 return false;

61}

62

64 unsigned major = 0, minor = 0, micro = 0, build = 0;

65

66

68 return true;

69

70 if (input.empty()) {

72 return false;

73 }

74

75

76 if (input[0] != '.')

77 return true;

78 input = input.substr(1);

80 return true;

81

82 if (input.empty()) {

84 return false;

85 }

86

87

89 return true;

91 return true;

92

93 if (input.empty()) {

95 return false;

96 }

97

98

100 return true;

102 return true;

103

104

105 if (!input.empty())

106 return true;

107

108 *this = VersionTuple(major, minor, micro, build);

109 return false;

110}

111

113 if (HasBuild)

114 return VersionTuple(NewMajor, Minor, Subminor, Build);

115 if (HasSubminor)

116 return VersionTuple(NewMajor, Minor, Subminor);

117 if (HasMinor)

120}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static bool parseInt(StringRef &input, unsigned &value)

Definition VersionTuple.cpp:41

Defines the llvm::VersionTuple class, which represents a version in the form major[....

StringRef - Represent a constant reference to a string, i.e.

constexpr StringRef substr(size_t Start, size_t N=npos) const

Return a reference to the substring from [Start, Start + N).

constexpr bool empty() const

empty - Check if the string is empty.

bool consume_front(StringRef Prefix)

Returns true if this StringRef has the given prefix and removes that prefix.

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

LLVM_ABI bool tryParse(StringRef string)

Try to parse the given string as a version number.

Definition VersionTuple.cpp:63

LLVM_ABI std::string getAsString() const

Retrieve a string representation of the version number.

Definition VersionTuple.cpp:21

LLVM_ABI VersionTuple withMajorReplaced(unsigned NewMajor) const

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

Definition VersionTuple.cpp:112

This class implements an extremely fast bulk output stream that can only output to a stream.

A raw_ostream that writes to an std::string.

This is an optimization pass for GlobalISel generic memory operations.

raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)