[PATCH] D45291: [Driver] Infer Android sysroot location.

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 12:42:09 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC331390: [Driver] Infer Android sysroot location. (authored by danalbert, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45291?vs=141067&id=144916#toc

Repository:
  rC Clang

https://reviews.llvm.org/D45291

Files:
  lib/Driver/ToolChains/Linux.cpp


Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -429,6 +429,15 @@
   if (!getDriver().SysRoot.empty())
     return getDriver().SysRoot;
 
+  if (getTriple().isAndroid()) {
+    // Android toolchains typically include a sysroot at ../sysroot relative to
+    // the clang binary.
+    const StringRef ClangDir = getDriver().getInstalledDir();
+    std::string AndroidSysRootPath = (ClangDir + "/../sysroot").str();
+    if (getVFS().exists(AndroidSysRootPath))
+      return AndroidSysRootPath;
+  }
+
   if (!GCCInstallation.isValid() || !tools::isMipsArch(getTriple().getArch()))
     return std::string();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45291.144916.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180502/13099044/attachment.bin>


More information about the cfe-commits mailing list