summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/Linux.cpp
diff options
context:
space:
mode:
authorDavid Zarzycki <dave@znu.io>2019-12-08 16:41:46 +0200
committerDavid Zarzycki <dave@znu.io>2019-12-08 16:41:46 +0200
commitb32490270b786d2c5ba154e613ee2d5e36ed4197 (patch)
tree4769c2f9c3b739ecfe718a81c212ddd6c4a0043b /clang/lib/Driver/ToolChains/Linux.cpp
parent68f464ac2ef5de8cb2e8beaeee43c435c536539e (diff)
downloadbcm5719-llvm-b32490270b786d2c5ba154e613ee2d5e36ed4197.tar.gz
bcm5719-llvm-b32490270b786d2c5ba154e613ee2d5e36ed4197.zip
Revert "Driver: Don't look for libc++ headers in the install directory on Android."
This reverts commit 198fbcb817492ff45946e3f7517de15e8cdf0607. This breaks Fedora 31.
Diffstat (limited to 'clang/lib/Driver/ToolChains/Linux.cpp')
-rw-r--r--clang/lib/Driver/ToolChains/Linux.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index adacd705d83..736a2d435ca 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -888,25 +888,20 @@ static std::string DetectLibcxxIncludePath(llvm::vfs::FileSystem &vfs,
void Linux::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const {
const std::string& SysRoot = computeSysRoot();
- auto AddIncludePath = [&](std::string Path) {
- std::string IncludePath = DetectLibcxxIncludePath(getVFS(), Path);
+ const std::string LibCXXIncludePathCandidates[] = {
+ DetectLibcxxIncludePath(getVFS(), 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(getVFS(), SysRoot + "/usr/local/include/c++"),
+ DetectLibcxxIncludePath(getVFS(), SysRoot + "/usr/include/c++") };
+ for (const auto &IncludePath : LibCXXIncludePathCandidates) {
if (IncludePath.empty() || !getVFS().exists(IncludePath))
- return false;
+ continue;
+ // Use the first candidate that exists.
addSystemInclude(DriverArgs, CC1Args, IncludePath);
- return true;
- };
- // Android never uses the libc++ headers installed alongside the toolchain,
- // which are generally incompatible with the NDK libraries anyway.
- if (!getTriple().isAndroid())
- if (AddIncludePath(getDriver().Dir + "/../include/c++"))
- return;
- // 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:
- if (AddIncludePath(SysRoot + "/usr/local/include/c++"))
- return;
- if (AddIncludePath(SysRoot + "/usr/include/c++"))
return;
+ }
}
void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
OpenPOWER on IntegriCloud