Lines Matching +full:input +full:- +full:value
1 //===- VersionTuple.cpp - Version Number Handling ---------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
41 static bool parseInt(StringRef &input, unsigned &value) {
42 assert(value == 0);
43 if (input.empty())
46 char next = input[0];
47 input = input.substr(1);
50 value = (unsigned)(next - '0');
52 while (!input.empty()) {
53 next = input[0];
56 input = input.substr(1);
57 value = value * 10 + (unsigned)(next - '0');
63 bool VersionTuple::tryParse(StringRef input) {
66 // Parse the major version, [0-9]+
67 if (parseInt(input, major))
70 if (input.empty()) {
75 // If we're not done, parse the minor version, \.[0-9]+
76 if (input[0] != '.')
78 input = input.substr(1);
79 if (parseInt(input, minor))
82 if (input.empty()) {
87 // If we're not done, parse the micro version, \.[0-9]+
88 if (!input.consume_front("."))
90 if (parseInt(input, micro))
93 if (input.empty()) {
98 // If we're not done, parse the micro version, \.[0-9]+
99 if (!input.consume_front("."))
101 if (parseInt(input, build))
105 if (!input.empty())