aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-09-30 20:30:12 +0000
committerChris Lattner <sabre@nondot.org>2008-09-30 20:30:12 +0000
commit079f2c467d4893a80bf0dc5344505725f42ceb87 (patch)
treed678917b857763904c6c82fa446b349af5e280ac /Driver/clang.cpp
parentba0f25f754184e5260e3317c10c389a108f73421 (diff)
Handle minor version numbers in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
like "10.3.9" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index f75aacba76..9411dd3b1e 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -654,21 +654,16 @@ static void HandleMacOSVersionMin(std::string &Triple) {
char *End = 0;
VersionNum = (int)strtol(Start, &End, 10);
+ // The version number must be in the range 0-9.
+ MacOSVersionMinIsInvalid = (unsigned)VersionNum > 9;
+
// Turn MacOSVersionMin into a darwin number: e.g. 10.3.9 is 3 -> 7.
Triple += llvm::itostr(VersionNum+4);
- if (End[0] == '.') { // 10.4.17 is ok.
- // Add the period piece (.17) to the end of the triple. This gives us
- // something like ...-darwin8.17
+ if (End[0] == '.' && isdigit(End[1]) && End[2] == '\0') { // 10.4.7 is ok.
+ // Add the period piece (.7) to the end of the triple. This gives us
+ // something like ...-darwin8.7
Triple += End;
-
- // Verify that the rest after the number are all digits.
- for (++End; isdigit(*End); ++End)
- /*skip digits*/;
-
- // If there were any non-digits after the number, reject it.
- MacOSVersionMinIsInvalid = *End != '\0';
-
} else if (End[0] != '\0') { // "10.4" is ok. 10.4x is not.
MacOSVersionMinIsInvalid = true;
}