]> granicus.if.org Git - clang/commitdiff
Add missing OS check to r305678
authorAlex Lorenz <arphaman@gmail.com>
Mon, 19 Jun 2017 11:25:37 +0000 (11:25 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Mon, 19 Jun 2017 11:25:37 +0000 (11:25 +0000)
That commit failed on non-macOS buildbots as I've forgotten to make sure that
the system on which Clang is running on is actually macOS.

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

lib/Driver/ToolChains/Darwin.cpp

index 32925fde5ef139cf04a081041e7a47a496e55333..b47df960dd9e4da5e619a21b7427bb8a275e5642 100644 (file)
@@ -1124,8 +1124,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
 /// then the SDK version is returned. Otherwise the system version is returned.
 static std::string getSystemOrSDKMacOSVersion(StringRef MacOSSDKVersion) {
   unsigned Major, Minor, Micro;
-  llvm::Triple(llvm::sys::getProcessTriple())
-      .getMacOSXVersion(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,