[PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 14:46:00 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Driver/ToolChains.cpp:722-733
@@ -700,1 +721,14 @@
+
+  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);
+      if (!SDK.startswith(getPlatformFamily()))
+        getDriver().Diag(diag::warn_incompatible_sysroot)
+            << SDK << getPlatformFamily();
+    }
+  }
 }
----------------
Can you share some of the code between the parsing the SDK version out of `-isysroot` here and above?


http://reviews.llvm.org/D18088





More information about the cfe-commits mailing list