15 #include "llvm/Support/raw_ostream.h" 17 using namespace clang;
22 llvm::raw_string_ostream Out(Result);
40 static bool parseInt(StringRef &input,
unsigned &value) {
42 if (input.empty())
return true;
45 input = input.substr(1);
46 if (next < '0' || next >
'9')
return true;
47 value = (unsigned) (next -
'0');
49 while (!input.empty()) {
51 if (next < '0' || next >
'9')
return false;
52 input = input.substr(1);
53 value = value * 10 + (unsigned) (next -
'0');
60 unsigned major = 0, minor = 0, micro = 0, build = 0;
63 if (
parseInt(input, major))
return true;
71 if (input[0] !=
'.')
return true;
72 input = input.substr(1);
73 if (
parseInt(input, minor))
return true;
81 if (input[0] !=
'.')
return true;
82 input = input.substr(1);
83 if (
parseInt(input, micro))
return true;
91 if (input[0] !=
'.')
return true;
92 input = input.substr(1);
93 if (
parseInt(input, build))
return true;
96 if (!input.empty())
return true;
Optional< unsigned > getBuild() const
Retrieve the build version number, if provided.
Represents a version number in the form major[.minor[.subminor[.build]]].
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
bool usesUnderscores() const
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
The result type of a method or function.
static bool parseInt(StringRef &input, unsigned &value)
Dataflow Directional Tag Classes.
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
bool tryParse(StringRef string)
Try to parse the given string as a version number.
unsigned getMajor() const
Retrieve the major version number.
std::string getAsString() const
Retrieve a string representation of the version number.
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].