diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-01-25 08:04:13 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-01-25 08:04:13 +0000 |
commit | fc52f7526ea0adfcbdbe76a3c4fcdcbb1f1b08b6 (patch) | |
tree | 6428e4fc7fbcd35176497dac2298d9cc9981ad82 /lib/Driver/ToolChains.cpp | |
parent | 1c6f04a28d8a8e3eca966385815305b13e0a6a05 (diff) |
Switch the Linux C++ standard library header search logic over to use
the GCC installation's multiarch suffix now that it is exposed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148938 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 428f37cab7..ba0c2b431b 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -2262,19 +2262,10 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, return; } - // Check if the target architecture specific dirs need a suffix. Note that we - // only support the suffix-based bi-arch-like header scheme for host/target - // mismatches of just bit width. - // FIXME: This is using the Driver's target triple to emulate the host triple! - llvm::Triple::ArchType HostArch = getDriver().TargetTriple.getArch(); - llvm::Triple::ArchType TargetArch = TargetTriple.getArch(); - StringRef Suffix; - if ((HostArch == llvm::Triple::x86 && TargetArch == llvm::Triple::x86_64) || - (HostArch == llvm::Triple::ppc && TargetArch == llvm::Triple::ppc64)) - Suffix = "/64"; - if ((HostArch == llvm::Triple::x86_64 && TargetArch == llvm::Triple::x86) || - (HostArch == llvm::Triple::ppc64 && TargetArch == llvm::Triple::ppc)) - Suffix = "/32"; + // We need a detected GCC installation on Linux to provide libstdc++'s + // headers. We handled the libc++ case above. + if (!GCCInstallation.isValid()) + return; // By default, look for the C++ headers in an include directory adjacent to // the lib directory of the GCC installation. Note that this is expect to be @@ -2283,12 +2274,14 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, StringRef InstallDir = GCCInstallation.getInstallPath(); StringRef Version = GCCInstallation.getVersion(); if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version, - GCCInstallation.getTriple().str() + Suffix, + (GCCInstallation.getTriple().str() + + GCCInstallation.getMultiarchSuffix()), DriverArgs, CC1Args)) { // Gentoo is weird and places its headers inside the GCC install, so if the // first attempt to find the headers fails, try this pattern. addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", - GCCInstallation.getTriple().str() + Suffix, + (GCCInstallation.getTriple().str() + + GCCInstallation.getMultiarchSuffix()), DriverArgs, CC1Args); } } |