[llvm-branch-commits] [cfe-branch] r92886 - in /cfe/branches/Apple/Dib: test/Frontend/darwin-version.c tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Wed Jan 6 16:54:15 PST 2010
Author: ddunbar
Date: Wed Jan 6 18:54:15 2010
New Revision: 92886
URL: http://llvm.org/viewvc/llvm-project?rev=92886&view=rev
Log:
clang-cc: Allow micro version in release number parsing.
Modified:
cfe/branches/Apple/Dib/test/Frontend/darwin-version.c
cfe/branches/Apple/Dib/tools/clang-cc/clang-cc.cpp
Modified: cfe/branches/Apple/Dib/test/Frontend/darwin-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Frontend/darwin-version.c?rev=92886&r1=92885&r2=92886&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/Frontend/darwin-version.c (original)
+++ cfe/branches/Apple/Dib/test/Frontend/darwin-version.c Wed Jan 6 18:54:15 2010
@@ -6,6 +6,8 @@
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 &&
// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t - < /dev/null &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1 &&
+// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.2.2 -dM -E -o %t - < /dev/null &&
+// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1 &&
// RUN: clang-cc -triple i686-apple-darwin8 -dM -E -o %t - < /dev/null &&
// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 &&
// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 &&
Modified: cfe/branches/Apple/Dib/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/tools/clang-cc/clang-cc.cpp?rev=92886&r1=92885&r2=92886&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/branches/Apple/Dib/tools/clang-cc/clang-cc.cpp Wed Jan 6 18:54:15 2010
@@ -927,7 +927,8 @@
// Remove the number.
Triple.resize(DarwinNumIdx);
- // Validate that IPhoneOSVersionMin is a 'version number', starting with [2-9].[0-9]
+ // Validate that IPhoneOSVersionMin is a 'version number', matching
+ // '[2-9].[0-9](.[0-9])?'.
bool IPhoneOSVersionMinIsInvalid = false;
int VersionNum = 0;
if (IPhoneOSVersionMin.size() < 3 ||
@@ -944,13 +945,20 @@
// Turn IPhoneOSVersionMin into a darwin number: e.g. 2.0 is 2 -> 9.2.
Triple += "9." + llvm::itostr(VersionNum);
- if (End[0] == '.' && isdigit(End[1]) && End[2] == '\0') { // 2.2 is ok.
+ if (End[0] == '.' && isdigit(End[1])) { // 2.2 is ok.
// Add the period piece (.2) to the end of the triple. This gives us
// something like ...-darwin9.2.2
- Triple += End;
- } else if (End[0] != '\0') { // "2.2" is ok. 2x is not.
- IPhoneOSVersionMinIsInvalid = true;
+ Triple += End[0];
+ Triple += End[1];
+ End += 2;
}
+
+ // Ignore final component, if any.
+ if (End[0] == '.' && isdigit(End[1]))
+ End += 2;
+
+ if (End[0] != '\0') // Check that there is no trailing garbage.
+ IPhoneOSVersionMinIsInvalid = true;
}
if (IPhoneOSVersionMinIsInvalid) {
More information about the llvm-branch-commits
mailing list