]> granicus.if.org Git - clang/commitdiff
Revert r305678: [driver][macOS] Pick the system version for the
authorAlex Lorenz <arphaman@gmail.com>
Wed, 21 Jun 2017 10:27:24 +0000 (10:27 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 21 Jun 2017 10:27:24 +0000 (10:27 +0000)
deployment target if the SDK is newer than the system

This commit also reverts follow-up commits r305680 and r305685 that have
buildbot fixes.

The change in r305678 wasn't correct because it relied on
`llvm::sys::getProcessTriple`, which uses a pre-configured OS version. We should
lookup the actual macOS version of the system on which the compiler is running.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305891 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Darwin.cpp
test/Driver/darwin-sdk-vs-os-version.c [deleted file]

index b47df960dd9e4da5e619a21b7427bb8a275e5642..e41b50c40b2898f02ec47f940e3466b90d3051b5 100644 (file)
@@ -1118,27 +1118,6 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
   }
 }
 
-/// Returns the most appropriate macOS target version for the current process.
-///
-/// If the macOS SDK version is the same or earlier than the system version,
-/// then the SDK version is returned. Otherwise the system version is returned.
-static std::string getSystemOrSDKMacOSVersion(StringRef MacOSSDKVersion) {
-  unsigned Major, Minor, Micro;
-  llvm::Triple SystemTriple(llvm::sys::getProcessTriple());
-  if (!SystemTriple.isMacOSX())
-    return MacOSSDKVersion;
-  SystemTriple.getMacOSXVersion(Major, Minor, Micro);
-  VersionTuple SystemVersion(Major, Minor, Micro);
-  bool HadExtra;
-  if (!Driver::GetReleaseVersion(MacOSSDKVersion, Major, Minor, Micro,
-                                 HadExtra))
-    return MacOSSDKVersion;
-  VersionTuple SDKVersion(Major, Minor, Micro);
-  if (SDKVersion > SystemVersion)
-    return SystemVersion.getAsString();
-  return MacOSSDKVersion;
-}
-
 void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
   const OptTable &Opts = getDriver().getOpts();
 
@@ -1231,7 +1210,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
                 SDK.startswith("iPhoneSimulator"))
               iOSTarget = Version;
             else if (SDK.startswith("MacOSX"))
-              OSXTarget = getSystemOrSDKMacOSVersion(Version);
+              OSXTarget = Version;
             else if (SDK.startswith("WatchOS") ||
                      SDK.startswith("WatchSimulator"))
               WatchOSTarget = Version;
diff --git a/test/Driver/darwin-sdk-vs-os-version.c b/test/Driver/darwin-sdk-vs-os-version.c
deleted file mode 100644 (file)
index 391f4d5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// REQUIRES: system-darwin
-
-// Ensure that we never pick a version that's based on the SDK that's newer than
-// the system version:
-// RUN: rm -rf %t/SDKs/MacOSX10.99.99.sdk
-// RUN: mkdir -p %t/SDKs/MacOSX10.99.99.sdk
-// RUN: %clang -target x86_64-apple-darwin -isysroot %t/SDKs/MacOSX10.99.99.sdk %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-MACOSX-SYSTEM-VERSION %s
-
-// CHECK-MACOSX-SYSTEM-VERSION-NOT: 10.99.99"