From: Alex Lorenz Date: Mon, 19 Jun 2017 11:25:37 +0000 (+0000) Subject: Add missing OS check to r305678 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ee5ac604b35db8d381cfe8ab1f5883615f20b22;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305680 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 32925fde5e..b47df960dd 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -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,