r331389 - [Driver] Obey computed sysroot when finding libc++ headers.

Dan Albert via cfe-commits cfe-commits at lists.llvm.org
Wed May 2 12:31:01 PDT 2018


Author: danalbert
Date: Wed May  2 12:31:01 2018
New Revision: 331389

URL: http://llvm.org/viewvc/llvm-project?rev=331389&view=rev
Log:
[Driver] Obey computed sysroot when finding libc++ headers.

Summary:
A handful of targets will try some default paths if --sysroot is not provided.
If that is the case, it should be used for the libc++ header paths.

Reviewers: srhines, EricWF

Reviewed By: srhines

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D45292

Modified:
    cfe/trunk/lib/Driver/ToolChains/Linux.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=331389&r1=331388&r2=331389&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Wed May  2 12:31:01 2018
@@ -793,13 +793,14 @@ static std::string DetectLibcxxIncludePa
 
 void Linux::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
                                   llvm::opt::ArgStringList &CC1Args) const {
+  const std::string& SysRoot = computeSysRoot();
   const std::string LibCXXIncludePathCandidates[] = {
       DetectLibcxxIncludePath(getDriver().Dir + "/../include/c++"),
       // If this is a development, non-installed, clang, libcxx will
       // not be found at ../include/c++ but it likely to be found at
       // one of the following two locations:
-      DetectLibcxxIncludePath(getDriver().SysRoot + "/usr/local/include/c++"),
-      DetectLibcxxIncludePath(getDriver().SysRoot + "/usr/include/c++") };
+      DetectLibcxxIncludePath(SysRoot + "/usr/local/include/c++"),
+      DetectLibcxxIncludePath(SysRoot + "/usr/include/c++") };
   for (const auto &IncludePath : LibCXXIncludePathCandidates) {
     if (IncludePath.empty() || !getVFS().exists(IncludePath))
       continue;




More information about the cfe-commits mailing list