From c371ff048df8731052976f4e628ed1861cf61cfd Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 22 Mar 2015 08:39:22 +0000 Subject: MS ABI: Implement driver-level support for thread-safe statics Decide whether or not to use thread-safe statics depending on whether or not we have an explicit request from the driver. If we don't have an explicit request, infer which behavior to use depending on the compatibility version we are targeting. N.B. CodeGen support is still ongoing. llvm-svn: 232906 --- clang/lib/Basic/VersionTuple.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'clang/lib/Basic/VersionTuple.cpp') diff --git a/clang/lib/Basic/VersionTuple.cpp b/clang/lib/Basic/VersionTuple.cpp index aa43ae298e2..9c73fd98a17 100644 --- a/clang/lib/Basic/VersionTuple.cpp +++ b/clang/lib/Basic/VersionTuple.cpp @@ -32,6 +32,8 @@ raw_ostream& clang::operator<<(raw_ostream &Out, Out << (V.usesUnderscores() ? '_' : '.') << *Minor; if (Optional Subminor = V.getSubminor()) Out << (V.usesUnderscores() ? '_' : '.') << *Subminor; + if (Optional Build = V.getBuild()) + Out << (V.usesUnderscores() ? '_' : '.') << *Build; return Out; } @@ -55,7 +57,7 @@ static bool parseInt(StringRef &input, unsigned &value) { } bool VersionTuple::tryParse(StringRef input) { - unsigned major = 0, minor = 0, micro = 0; + unsigned major = 0, minor = 0, micro = 0, build = 0; // Parse the major version, [0-9]+ if (parseInt(input, major)) return true; @@ -80,9 +82,19 @@ bool VersionTuple::tryParse(StringRef input) { input = input.substr(1); if (parseInt(input, micro)) return true; + if (input.empty()) { + *this = VersionTuple(major, minor, micro); + return false; + } + + // If we're not done, parse the micro version, \.[0-9]+ + if (input[0] != '.') return true; + input = input.substr(1); + if (parseInt(input, build)) return true; + // If we have characters left over, it's an error. if (!input.empty()) return true; - *this = VersionTuple(major, minor, micro); + *this = VersionTuple(major, minor, micro, build); return false; } -- cgit v1.2.3