r305680 - Add missing OS check to r305678

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 19 04:25:38 PDT 2017

Author: arphaman
Date: Mon Jun 19 06:25:37 2017
New Revision: 305680

URL: http://llvm.org/viewvc/llvm-project?rev=305680&view=rev
Add missing OS check to r305678

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.


Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=305680&r1=305679&r2=305680&view=diff
--- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Mon Jun 19 06:25:37 2017
@@ -1124,8 +1124,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(
 /// 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,

More information about the cfe-commits mailing list