[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    Re: r268127 - Add a new warning to notify users of mismatched SDK and deployment target
From:       Chris Bieneman via cfe-commits <cfe-commits () lists ! llvm ! org>
Date:       2016-04-30 5:33:43
Message-ID: A56588AE-373A-4B54-A10C-E1747D076E37 () apple ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Took a blind stab at fixing it in r268156.

-Chris

> On Apr 29, 2016, at 10:10 PM, Chris Bieneman via cfe-commits \
> <cfe-commits@lists.llvm.org> wrote: 
> Unless I'm reading the log wrong there doesn't seem to be any error text getting \
> logged. 
> Any idea what that is about?
> 
> -Chris
> 
> On Apr 29, 2016, at 9:49 PM, Sean Silva <chisophugis@gmail.com \
> <mailto:chisophugis@gmail.com>> wrote: 
> > This breaks the PS4 bots at least. They've been red for hours now.
> > http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast?numbuilds=100 \
> > <http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast?numbuilds=100>
> >  
> > On Fri, Apr 29, 2016 at 3:28 PM, Chris Bieneman via cfe-commits \
> >                 <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> \
> >                 wrote:
> > Author: cbieneman
> > Date: Fri Apr 29 17:28:34 2016
> > New Revision: 268127
> > 
> > URL: http://llvm.org/viewvc/llvm-project?rev=268127&view=rev \
> > <http://llvm.org/viewvc/llvm-project?rev=268127&view=rev> Log:
> > Add a new warning to notify users of mismatched SDK and deployment target
> > 
> > Summary:
> > This patch adds a new driver warning -Wincompatible-sdk which notifies the user \
> > when they are mismatching the version min options and the sysroot. 
> > 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. 
> > Reviewers: bob.wilson, rsmith
> > 
> > Subscribers: rsmith, edward-san, cfe-commits
> > 
> > Differential Revision: http://reviews.llvm.org/D18088 \
> > <http://reviews.llvm.org/D18088> 
> > Added:
> > cfe/trunk/test/Driver/incompatible_sysroot.c
> > Modified:
> > cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
> > cfe/trunk/lib/Driver/ToolChains.cpp
> > cfe/trunk/lib/Driver/ToolChains.h
> > 
> > Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=268127&r1=268126&r2=268127&view=diff \
> > <http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=268127&r1=268126&r2=268127&view=diff>
> >  ==============================================================================
> > --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
> > +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri Apr 29 17:28:34 \
> > 2016 @@ -198,6 +198,8 @@ def warn_drv_pch_not_first_include : War
> > "precompiled header '%0' was ignored because '%1' is not first '-include'">;
> > def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
> > InGroup<DiagGroup<"missing-sysroot">>;
> > +def warn_incompatible_sysroot : Warning<"using sysroot for '%0' but targeting \
> > '%1'">, +  InGroup<DiagGroup<"incompatible-sysroot">>;
> > def warn_debug_compression_unavailable : Warning<"cannot compress debug sections \
> > (zlib not installed)">, InGroup<DiagGroup<"debug-compression-unavailable">>;
> > def warn_drv_enabling_rtti_with_exceptions : Warning<
> > 
> > Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268127&r1=268126&r2=268127&view=diff \
> > <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268127&r1=268126&r2=268127&view=diff>
> >  ==============================================================================
> > --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> > +++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Apr 29 17:28:34 2016
> > @@ -329,6 +329,36 @@ void MachO::AddLinkRuntimeLib(const ArgL
> > }
> > }
> > 
> > +StringRef Darwin::getPlatformFamily() const {
> > +  switch (TargetPlatform) {
> > +    case DarwinPlatformKind::MacOS:
> > +      return "MacOSX";
> > +    case DarwinPlatformKind::IPhoneOS:
> > +    case DarwinPlatformKind::IPhoneOSSimulator:
> > +      return "iPhone";
> > +    case DarwinPlatformKind::TvOS:
> > +    case DarwinPlatformKind::TvOSSimulator:
> > +      return "AppleTV";
> > +    case DarwinPlatformKind::WatchOS:
> > +    case DarwinPlatformKind::WatchOSSimulator:
> > +      return "Watch";
> > +  }
> > +  llvm_unreachable("Unsupported platform");
> > +}
> > +
> > +StringRef Darwin::getSDKName(StringRef isysroot) {
> > +  // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk
> > +  llvm::sys::path::const_iterator SDKDir;
> > +  auto BeginSDK = llvm::sys::path::begin(isysroot);
> > +  auto EndSDK = llvm::sys::path::end(isysroot);
> > +  for (auto IT = BeginSDK; IT != EndSDK; ++IT) {
> > +    StringRef SDK = *IT;
> > +    if (SDK.endswith(".sdk"))
> > +      return SDK.slice(0, SDK.size() - 4);
> > +  }
> > +  return "";
> > +}
> > +
> > StringRef Darwin::getOSLibraryNameSuffix() const {
> > switch(TargetPlatform) {
> > case DarwinPlatformKind::MacOS:
> > @@ -540,11 +570,8 @@ void Darwin::AddDeploymentTarget(Derived
> > TvOSTarget.empty() && Args.hasArg(options::OPT_isysroot)) {
> > if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
> > StringRef isysroot = A->getValue();
> > -        // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk
> > -        size_t BeginSDK = isysroot.rfind("SDKs/");
> > -        size_t EndSDK = isysroot.rfind(".sdk");
> > -        if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) {
> > -          StringRef SDK = isysroot.slice(BeginSDK + 5, EndSDK);
> > +        StringRef SDK = getSDKName(isysroot);
> > +        if (SDK.size() > 0) {
> > // Slice the version number out.
> > // Version number is between the first and the last number.
> > size_t StartVer = SDK.find_first_of("0123456789");
> > @@ -697,6 +724,17 @@ void Darwin::AddDeploymentTarget(Derived
> > Platform = WatchOSSimulator;
> > 
> > setTarget(Platform, Major, Minor, Micro);
> > +
> > +  if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
> > +    StringRef SDK = getSDKName(A->getValue());
> > +    if (SDK.size() > 0) {
> > +      size_t StartVer = SDK.find_first_of("0123456789");
> > +      StringRef SDKName = SDK.slice(0, StartVer);
> > +      if (!SDKName.startswith(getPlatformFamily()))
> > +        getDriver().Diag(diag::warn_incompatible_sysroot)
> > +            << SDKName << getPlatformFamily();
> > +    }
> > +  }
> > }
> > 
> > void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
> > 
> > Modified: cfe/trunk/lib/Driver/ToolChains.h
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=268127&r1=268126&r2=268127&view=diff \
> > <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=268127&r1=268126&r2=268127&view=diff>
> >  ==============================================================================
> > --- cfe/trunk/lib/Driver/ToolChains.h (original)
> > +++ cfe/trunk/lib/Driver/ToolChains.h Fri Apr 29 17:28:34 2016
> > @@ -496,6 +496,8 @@ protected:
> > return TargetVersion < VersionTuple(V0, V1, V2);
> > }
> > 
> > +  StringRef getPlatformFamily() const;
> > +  static StringRef getSDKName(StringRef isysroot);
> > StringRef getOSLibraryNameSuffix() const;
> > 
> > public:
> > 
> > Added: cfe/trunk/test/Driver/incompatible_sysroot.c
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/incompatible_sysroot.c?rev=268127&view=auto \
> > <http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/incompatible_sysroot.c?rev=268127&view=auto>
> >  ==============================================================================
> > --- cfe/trunk/test/Driver/incompatible_sysroot.c (added)
> > +++ cfe/trunk/test/Driver/incompatible_sysroot.c Fri Apr 29 17:28:34 2016
> > @@ -0,0 +1,12 @@
> > +// 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 \
> > +// 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 +// 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 +// 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 +// 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 +
> > +int main() { return 0; }
> > +// CHECK-OSX-IOS: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
> > +// CHECK-IOS-WATCHOS: warning: using sysroot for 'iPhoneOS' but targeting \
> > 'Watch' +// CHECK-IOS-TVOS: warning: using sysroot for 'iPhoneOS' but targeting \
> > 'AppleTV' +// CHECK-IOS-IOSSIM-NOT: warning: using sysroot for '{{.*}}' but \
> > targeting '{{.*}}' +// CHECK-OSX-IOS-DISABLED-NOT: warning: using sysroot for \
> > '{{.*}}' but targeting '{{.*}}' 
> > 
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits \
> > <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[Attachment #5 (unknown)]

<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="">Took a blind stab at fixing \
it in&nbsp;r268156.<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:10 PM, Chris Bieneman via cfe-commits &lt;<a \
href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>&gt; \
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 &lt;<a href="mailto:chisophugis@gmail.com" \
class="">chisophugis@gmail.com</a>&gt; 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="">&lt;<a href="mailto:cfe-commits@lists.llvm.org" \
target="_blank" class="">cfe-commits@lists.llvm.org</a>&gt;</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&amp;view=rev" \
rel="noreferrer" target="_blank" \
class="">http://llvm.org/viewvc/llvm-project?rev=268127&amp;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="">
&nbsp; &nbsp; cfe/trunk/test/Driver/incompatible_sysroot.c<br class="">
Modified:<br class="">
&nbsp; &nbsp; cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br class="">
&nbsp; &nbsp; cfe/trunk/lib/Driver/ToolChains.cpp<br class="">
&nbsp; &nbsp; 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&amp;r1=268126&amp;r2=268127&amp;view=diff" \
rel="noreferrer" target="_blank" \
class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=268127&amp;r1=268126&amp;r2=268127&amp;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=""> &nbsp; &nbsp;"precompiled header '%0' was ignored because '%1' is not first \
'-include'"&gt;;<br class=""> &nbsp;def warn_missing_sysroot : Warning&lt;"no such \
sysroot directory: '%0'"&gt;,<br class=""> &nbsp; \
&nbsp;InGroup&lt;DiagGroup&lt;"missing-sysroot"&gt;&gt;;<br class=""> +def \
warn_incompatible_sysroot : Warning&lt;"using sysroot for '%0' but targeting \
'%1'"&gt;,<br class=""> +&nbsp; \
InGroup&lt;DiagGroup&lt;"incompatible-sysroot"&gt;&gt;;<br class=""> &nbsp;def \
warn_debug_compression_unavailable : Warning&lt;"cannot compress debug sections (zlib \
not installed)"&gt;,<br class=""> &nbsp; \
&nbsp;InGroup&lt;DiagGroup&lt;"debug-compression-unavailable"&gt;&gt;;<br class=""> \
&nbsp;def warn_drv_enabling_rtti_with_exceptions : Warning&lt;<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&amp;r1=268126&amp;r2=268127&amp;view=diff" \
rel="noreferrer" target="_blank" \
class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268127&amp;r1=268126&amp;r2=268127&amp;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="">
&nbsp; &nbsp;}<br class="">
&nbsp;}<br class="">
<br class="">
+StringRef Darwin::getPlatformFamily() const {<br class="">
+&nbsp; switch (TargetPlatform) {<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::MacOS:<br class="">
+&nbsp; &nbsp; &nbsp; return "MacOSX";<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::IPhoneOS:<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::IPhoneOSSimulator:<br class="">
+&nbsp; &nbsp; &nbsp; return "iPhone";<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::TvOS:<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::TvOSSimulator:<br class="">
+&nbsp; &nbsp; &nbsp; return "AppleTV";<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::WatchOS:<br class="">
+&nbsp; &nbsp; case DarwinPlatformKind::WatchOSSimulator:<br class="">
+&nbsp; &nbsp; &nbsp; return "Watch";<br class="">
+&nbsp; }<br class="">
+&nbsp; llvm_unreachable("Unsupported platform");<br class="">
+}<br class="">
+<br class="">
+StringRef Darwin::getSDKName(StringRef isysroot) {<br class="">
+&nbsp; // Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk<br class="">
+&nbsp; llvm::sys::path::const_iterator SDKDir;<br class="">
+&nbsp; auto BeginSDK = llvm::sys::path::begin(isysroot);<br class="">
+&nbsp; auto EndSDK = llvm::sys::path::end(isysroot);<br class="">
+&nbsp; for (auto IT = BeginSDK; IT != EndSDK; ++IT) {<br class="">
+&nbsp; &nbsp; StringRef SDK = *IT;<br class="">
+&nbsp; &nbsp; if (SDK.endswith(".sdk"))<br class="">
+&nbsp; &nbsp; &nbsp; return SDK.slice(0, SDK.size() - 4);<br class="">
+&nbsp; }<br class="">
+&nbsp; return "";<br class="">
+}<br class="">
+<br class="">
&nbsp;StringRef Darwin::getOSLibraryNameSuffix() const {<br class="">
&nbsp; &nbsp;switch(TargetPlatform) {<br class="">
&nbsp; &nbsp;case DarwinPlatformKind::MacOS:<br class="">
@@ -540,11 +570,8 @@ void Darwin::AddDeploymentTarget(Derived<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TvOSTarget.empty() &amp;&amp; \
Args.hasArg(options::OPT_isysroot)) {<br class=""> &nbsp; &nbsp; &nbsp; &nbsp;if \
(const Arg *A = Args.getLastArg(options::OPT_isysroot)) {<br class=""> &nbsp; &nbsp; \
                &nbsp; &nbsp; &nbsp;StringRef isysroot = A-&gt;getValue();<br \
                class="">
-&nbsp; &nbsp; &nbsp; &nbsp; // Assume SDK has path: \
                SOME_PATH/SDKs/PlatformXX.YY.sdk<br class="">
-&nbsp; &nbsp; &nbsp; &nbsp; size_t BeginSDK = isysroot.rfind("SDKs/");<br class="">
-&nbsp; &nbsp; &nbsp; &nbsp; size_t EndSDK = isysroot.rfind(".sdk");<br class="">
-&nbsp; &nbsp; &nbsp; &nbsp; if (BeginSDK != StringRef::npos &amp;&amp; EndSDK != \
                StringRef::npos) {<br class="">
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringRef SDK = isysroot.slice(BeginSDK + 5, \
EndSDK);<br class=""> +&nbsp; &nbsp; &nbsp; &nbsp; StringRef SDK = \
getSDKName(isysroot);<br class=""> +&nbsp; &nbsp; &nbsp; &nbsp; if (SDK.size() &gt; \
0) {<br class=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Slice the version \
number out.<br class=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Version number \
is between the first and the last number.<br class=""> &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;size_t StartVer = SDK.find_first_of("0123456789");<br class=""> @@ \
-697,6 +724,17 @@ void Darwin::AddDeploymentTarget(Derived<br class=""> &nbsp; &nbsp; \
&nbsp;Platform = WatchOSSimulator;<br class=""> <br class="">
&nbsp; &nbsp;setTarget(Platform, Major, Minor, Micro);<br class="">
+<br class="">
+&nbsp; if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {<br class="">
+&nbsp; &nbsp; StringRef SDK = getSDKName(A-&gt;getValue());<br class="">
+&nbsp; &nbsp; if (SDK.size() &gt; 0) {<br class="">
+&nbsp; &nbsp; &nbsp; size_t StartVer = SDK.find_first_of("0123456789");<br class="">
+&nbsp; &nbsp; &nbsp; StringRef SDKName = SDK.slice(0, StartVer);<br class="">
+&nbsp; &nbsp; &nbsp; if (!SDKName.startswith(getPlatformFamily()))<br class="">
+&nbsp; &nbsp; &nbsp; &nbsp; getDriver().Diag(diag::warn_incompatible_sysroot)<br \
class=""> +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; SDKName &lt;&lt; \
getPlatformFamily();<br class=""> +&nbsp; &nbsp; }<br class="">
+&nbsp; }<br class="">
&nbsp;}<br class="">
<br class="">
&nbsp;void DarwinClang::AddCXXStdlibLibArgs(const ArgList &amp;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&amp;r1=268126&amp;r2=268127&amp;view=diff" \
rel="noreferrer" target="_blank" \
class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=268127&amp;r1=268126&amp;r2=268127&amp;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="">
&nbsp; &nbsp; &nbsp;return TargetVersion &lt; VersionTuple(V0, V1, V2);<br class="">
&nbsp; &nbsp;}<br class="">
<br class="">
+&nbsp; StringRef getPlatformFamily() const;<br class="">
+&nbsp; static StringRef getSDKName(StringRef isysroot);<br class="">
&nbsp; &nbsp;StringRef getOSLibraryNameSuffix() const;<br class="">
<br class="">
&nbsp;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&amp;view=auto" \
rel="noreferrer" target="_blank" \
class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/incompatible_sysroot.c?rev=268127&amp;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&gt;&amp;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&gt;&amp;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&gt;&amp;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&gt;&amp;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&gt;&amp;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="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<br \
class=""></div></blockquote></div><br class=""></div></body></html>


[Attachment #6 (text/plain)]

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic