This revision was automatically updated to reflect the committed changes. Closed by commit rL355282: [clang] [ToolChains/NetBSD] Support relative libc++ header path (authored by mgorny, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D58592?vs=188083&id=189076#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58592/new/ https://reviews.llvm.org/D58592 Files: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp @@ -16,6 +16,7 @@ #include "clang/Driver/Options.h" #include "clang/Driver/SanitizerArgs.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/VirtualFileSystem.h" using namespace clang::driver; using namespace clang::driver::tools; @@ -422,8 +423,23 @@ void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { - addSystemInclude(DriverArgs, CC1Args, - getDriver().SysRoot + "/usr/include/c++/"); + const std::string Candidates[] = { + // directory relative to build tree + getDriver().Dir + "/../include/c++/v1", + // system install with full upstream path + getDriver().SysRoot + "/usr/include/c++/v1", + // system install from src + getDriver().SysRoot + "/usr/include/c++", + }; + + for (const auto &IncludePath : Candidates) { + if (!getVFS().exists(IncludePath + "/__config")) + continue; + + // Use the first candidate that looks valid. + addSystemInclude(DriverArgs, CC1Args, IncludePath); + return; + } } void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp @@ -16,6 +16,7 @@ #include "clang/Driver/Options.h" #include "clang/Driver/SanitizerArgs.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/VirtualFileSystem.h" using namespace clang::driver; using namespace clang::driver::tools; @@ -422,8 +423,23 @@ void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { - addSystemInclude(DriverArgs, CC1Args, - getDriver().SysRoot + "/usr/include/c++/"); + const std::string Candidates[] = { + // directory relative to build tree + getDriver().Dir + "/../include/c++/v1", + // system install with full upstream path + getDriver().SysRoot + "/usr/include/c++/v1", + // system install from src + getDriver().SysRoot + "/usr/include/c++", + }; + + for (const auto &IncludePath : Candidates) { + if (!getVFS().exists(IncludePath + "/__config")) + continue; + + // Use the first candidate that looks valid. + addSystemInclude(DriverArgs, CC1Args, IncludePath); + return; + } } void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits