<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yep, looks like that fixed it. Sorry for the prolonged break.<div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 29, 2016, at 10:33 PM, Chris Bieneman <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Took a blind stab at fixing it in r268156.<div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 29, 2016, at 10:10 PM, Chris Bieneman via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""></div><div class="">Unless I'm reading the log wrong there doesn't seem to be any error text getting logged.</div><div class=""><br class=""></div><div class="">Any idea what that is about?</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class="">On Apr 29, 2016, at 9:49 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com" class="">chisophugis@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">This breaks the PS4 bots at least. They've been red for hours now.<div class=""><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast?numbuilds=100" class="">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast?numbuilds=100</a><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Apr 29, 2016 at 3:28 PM, Chris Bieneman via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: cbieneman<br class="">
Date: Fri Apr 29 17:28:34 2016<br class="">
New Revision: 268127<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268127&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=268127&view=rev</a><br class="">
Log:<br class="">
Add a new warning to notify users of mismatched SDK and deployment target<br class="">
<br class="">
Summary:<br class="">
This patch adds a new driver warning -Wincompatible-sdk which notifies the user when they are mismatching the version min options and the sysroot.<br class="">
<br class="">
The patch works by checking the sysroot (if present) for an SDK name, then matching that against the target platform. In the case of a mismatch it logs a warning.<br class="">
<br class="">
Reviewers: bob.wilson, rsmith<br class="">
<br class="">
Subscribers: rsmith, edward-san, cfe-commits<br class="">
<br class="">
Differential Revision: <a href="http://reviews.llvm.org/D18088" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D18088</a><br class="">
<br class="">
Added:<br class="">
    cfe/trunk/test/Driver/incompatible_sysroot.c<br class="">
Modified:<br class="">
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br class="">
    cfe/trunk/lib/Driver/ToolChains.cpp<br class="">
    cfe/trunk/lib/Driver/ToolChains.h<br class="">
<br class="">
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=268127&r1=268126&r2=268127&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=268127&r1=268126&r2=268127&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)<br class="">
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri Apr 29 17:28:34 2016<br class="">
@@ -198,6 +198,8 @@ def warn_drv_pch_not_first_include : War<br class="">
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;<br class="">
 def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,<br class="">
   InGroup<DiagGroup<"missing-sysroot">>;<br class="">
+def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting '%1'">,<br class="">
+  InGroup<DiagGroup<"incompatible-sysroot">>;<br class="">
 def warn_debug_compression_unavailable : Warning<"cannot compress debug sections (zlib not installed)">,<br class="">
   InGroup<DiagGroup<"debug-compression-unavailable">>;<br class="">
 def warn_drv_enabling_rtti_with_exceptions : Warning<<br class="">
<br class="">
Modified: cfe/trunk/lib/Driver/ToolChains.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268127&r1=268126&r2=268127&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268127&r1=268126&r2=268127&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)<br class="">
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Apr 29 17:28:34 2016<br class="">
@@ -329,6 +329,36 @@ void MachO::AddLinkRuntimeLib(const ArgL<br class="">
   }<br class="">
 }<br class="">
<br class="">
+StringRef Darwin::getPlatformFamily() const {<br class="">
+  switch (TargetPlatform) {<br class="">
+    case DarwinPlatformKind::MacOS:<br class="">
+      return "MacOSX";<br class="">
+    case DarwinPlatformKind::IPhoneOS:<br class="">
+    case DarwinPlatformKind::IPhoneOSSimulator:<br class="">
+      return "iPhone";<br class="">
+    case DarwinPlatformKind::TvOS:<br class="">
+    case DarwinPlatformKind::TvOSSimulator:<br class="">
+      return "AppleTV";<br class="">
+    case DarwinPlatformKind::WatchOS:<br class="">
+    case DarwinPlatformKind::WatchOSSimulator:<br class="">
+      return "Watch";<br class="">
+  }<br class="">
+  llvm_unreachable("Unsupported platform");<br class="">
+}<br class="">
+<br class="">
+StringRef Darwin::getSDKName(StringRef isysroot) {<br class="">
+  // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk<br class="">
+  llvm::sys::path::const_iterator SDKDir;<br class="">
+  auto BeginSDK = llvm::sys::path::begin(isysroot);<br class="">
+  auto EndSDK = llvm::sys::path::end(isysroot);<br class="">
+  for (auto IT = BeginSDK; IT != EndSDK; ++IT) {<br class="">
+    StringRef SDK = *IT;<br class="">
+    if (SDK.endswith(".sdk"))<br class="">
+      return SDK.slice(0, SDK.size() - 4);<br class="">
+  }<br class="">
+  return "";<br class="">
+}<br class="">
+<br class="">
 StringRef Darwin::getOSLibraryNameSuffix() const {<br class="">
   switch(TargetPlatform) {<br class="">
   case DarwinPlatformKind::MacOS:<br class="">
@@ -540,11 +570,8 @@ void Darwin::AddDeploymentTarget(Derived<br class="">
         TvOSTarget.empty() && Args.hasArg(options::OPT_isysroot)) {<br class="">
       if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {<br class="">
         StringRef isysroot = A->getValue();<br class="">
-        // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk<br class="">
-        size_t BeginSDK = isysroot.rfind("SDKs/");<br class="">
-        size_t EndSDK = isysroot.rfind(".sdk");<br class="">
-        if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) {<br class="">
-          StringRef SDK = isysroot.slice(BeginSDK + 5, EndSDK);<br class="">
+        StringRef SDK = getSDKName(isysroot);<br class="">
+        if (SDK.size() > 0) {<br class="">
           // Slice the version number out.<br class="">
           // Version number is between the first and the last number.<br class="">
           size_t StartVer = SDK.find_first_of("0123456789");<br class="">
@@ -697,6 +724,17 @@ void Darwin::AddDeploymentTarget(Derived<br class="">
     Platform = WatchOSSimulator;<br class="">
<br class="">
   setTarget(Platform, Major, Minor, Micro);<br class="">
+<br class="">
+  if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {<br class="">
+    StringRef SDK = getSDKName(A->getValue());<br class="">
+    if (SDK.size() > 0) {<br class="">
+      size_t StartVer = SDK.find_first_of("0123456789");<br class="">
+      StringRef SDKName = SDK.slice(0, StartVer);<br class="">
+      if (!SDKName.startswith(getPlatformFamily()))<br class="">
+        getDriver().Diag(diag::warn_incompatible_sysroot)<br class="">
+            << SDKName << getPlatformFamily();<br class="">
+    }<br class="">
+  }<br class="">
 }<br class="">
<br class="">
 void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,<br class="">
<br class="">
Modified: cfe/trunk/lib/Driver/ToolChains.h<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=268127&r1=268126&r2=268127&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=268127&r1=268126&r2=268127&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/Driver/ToolChains.h (original)<br class="">
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Apr 29 17:28:34 2016<br class="">
@@ -496,6 +496,8 @@ protected:<br class="">
     return TargetVersion < VersionTuple(V0, V1, V2);<br class="">
   }<br class="">
<br class="">
+  StringRef getPlatformFamily() const;<br class="">
+  static StringRef getSDKName(StringRef isysroot);<br class="">
   StringRef getOSLibraryNameSuffix() const;<br class="">
<br class="">
 public:<br class="">
<br class="">
Added: cfe/trunk/test/Driver/incompatible_sysroot.c<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/incompatible_sysroot.c?rev=268127&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/incompatible_sysroot.c?rev=268127&view=auto</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Driver/incompatible_sysroot.c (added)<br class="">
+++ cfe/trunk/test/Driver/incompatible_sysroot.c Fri Apr 29 17:28:34 2016<br class="">
@@ -0,0 +1,12 @@<br class="">
+// RUN: %clang -Wincompatible-sysroot -isysroot SDKs/MacOSX10.9.sdk -mios-version-min=9.0 -S -o - %s 2>&1 | FileCheck -check-prefix CHECK-OSX-IOS %s<br class="">
+// RUN: %clang -Wincompatible-sysroot -isysroot SDKs/iPhoneOS9.2.sdk -mwatchos-version-min=2.0 -S -o - %s 2>&1 | FileCheck -check-prefix CHECK-IOS-WATCHOS %s<br class="">
+// RUN: %clang -Wincompatible-sysroot -isysroot SDKs/iPhoneOS9.2.sdk -mtvos-version-min=9.0 -S -o - %s 2>&1 | FileCheck -check-prefix CHECK-IOS-TVOS %s<br class="">
+// RUN: %clang -Wincompatible-sysroot -isysroot SDKs/iPhoneSimulator9.2.sdk -mios-version-min=9.0 -S -o - %s 2>&1 | FileCheck -check-prefix CHECK-IOS-IOSSIM %s<br class="">
+// RUN: %clang -Wno-incompatible-sysroot -isysroot SDKs/MacOSX10.9.sdk -mios-version-min=9.0 -S -o - %s 2>&1 | FileCheck -check-prefix CHECK-OSX-IOS-DISABLED %s<br class="">
+<br class="">
+int main() { return 0; }<br class="">
+// CHECK-OSX-IOS: warning: using sysroot for 'MacOSX' but targeting 'iPhone'<br class="">
+// CHECK-IOS-WATCHOS: warning: using sysroot for 'iPhoneOS' but targeting 'Watch'<br class="">
+// CHECK-IOS-TVOS: warning: using sysroot for 'iPhoneOS' but targeting 'AppleTV'<br class="">
+// CHECK-IOS-IOSSIM-NOT: warning: using sysroot for '{{.*}}' but targeting '{{.*}}'<br class="">
+// CHECK-OSX-IOS-DISABLED-NOT: warning: using sysroot for '{{.*}}' but targeting '{{.*}}'<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div>_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>