[cfe-commits] r149652 - in /cfe/trunk: include/clang/Config/config.h.cmake lib/Driver/ToolChains.cpp lib/Frontend/InitHeaderSearch.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Feb 2 17:01:20 PST 2012
Author: rafael
Date: Thu Feb 2 19:01:20 2012
New Revision: 149652
URL: http://llvm.org/viewvc/llvm-project?rev=149652&view=rev
Log:
Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).
Modified:
cfe/trunk/include/clang/Config/config.h.cmake
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Modified: cfe/trunk/include/clang/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Config/config.h.cmake?rev=149652&r1=149651&r2=149652&view=diff
==============================================================================
--- cfe/trunk/include/clang/Config/config.h.cmake (original)
+++ cfe/trunk/include/clang/Config/config.h.cmake Thu Feb 2 19:01:20 2012
@@ -4,17 +4,8 @@
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
-/* 32 bit multilib directory. */
-#define CXX_INCLUDE_32BIT_DIR "${CXX_INCLUDE_32BIT_DIR}"
-
-/* 64 bit multilib directory. */
-#define CXX_INCLUDE_64BIT_DIR "${CXX_INCLUDE_64BIT_DIR}"
-
-/* Arch the libstdc++ headers. */
-#define CXX_INCLUDE_ARCH "${CXX_INCLUDE_ARCH}"
-
-/* Directory with the libstdc++ headers. */
-#define CXX_INCLUDE_ROOT "${CXX_INCLUDE_ROOT}"
+/* Directory with the libstdc++ installation. */
+#define GCC_INSTALL_PREFIX "${GCC_INSTALL_PREFIX}"
/* Directories clang will search for headers */
#define C_INCLUDE_DIRS "${C_INCLUDE_DIRS}"
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=149652&r1=149651&r2=149652&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Feb 2 19:01:20 2012
@@ -37,7 +37,7 @@
# include "clang/Config/config.h"
#endif
-#include "llvm/Config/config.h" // for CXX_INCLUDE_ROOT
+#include "llvm/Config/config.h" // for GCC_INSTALL_PREFIX
using namespace clang::driver;
using namespace clang::driver::toolchains;
@@ -1116,34 +1116,6 @@
const Driver &D,
const llvm::Triple &TargetTriple)
: IsValid(false) {
- // FIXME: Using CXX_INCLUDE_ROOT is here is a bit of a hack, but
- // avoids adding yet another option to configure/cmake.
- // It would probably be cleaner to break it in two variables
- // CXX_GCC_ROOT with just /foo/bar
- // CXX_GCC_VER with 4.5.2
- // Then we would have
- // CXX_INCLUDE_ROOT = CXX_GCC_ROOT/include/c++/CXX_GCC_VER
- // and this function would return
- // CXX_GCC_ROOT/lib/gcc/CXX_INCLUDE_ARCH/CXX_GCC_VER
- llvm::SmallString<128> CxxIncludeRoot(CXX_INCLUDE_ROOT);
- if (CxxIncludeRoot != "") {
- // This is of the form /foo/bar/include/c++/4.5.2/
- if (CxxIncludeRoot.back() == '/')
- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the /
- StringRef Version = llvm::sys::path::filename(CxxIncludeRoot);
- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version
- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++
- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include
- GCCInstallPath = CxxIncludeRoot.str();
- GCCInstallPath.append("/lib/gcc/");
- GCCInstallPath.append(CXX_INCLUDE_ARCH);
- GCCInstallPath.append("/");
- GCCInstallPath.append(Version);
- GCCParentLibPath = GCCInstallPath + "/../../..";
- IsValid = true;
- return;
- }
-
llvm::Triple MultiarchTriple = getMultiarchAlternateTriple(TargetTriple);
llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
// The library directories which may contain GCC installations.
@@ -1159,9 +1131,18 @@
// Compute the set of prefixes for our search.
SmallVector<std::string, 8> Prefixes(D.PrefixDirs.begin(),
D.PrefixDirs.end());
- Prefixes.push_back(D.SysRoot);
- Prefixes.push_back(D.SysRoot + "/usr");
- Prefixes.push_back(D.InstalledDir + "/..");
+
+ llvm::SmallString<128> CxxInstallRoot(GCC_INSTALL_PREFIX);
+ if (CxxInstallRoot != "") {
+ if (CxxInstallRoot.back() == '/')
+ llvm::sys::path::remove_filename(CxxInstallRoot); // remove the /
+
+ Prefixes.push_back(CxxInstallRoot.str());
+ } else {
+ Prefixes.push_back(D.SysRoot);
+ Prefixes.push_back(D.SysRoot + "/usr");
+ Prefixes.push_back(D.InstalledDir + "/..");
+ }
// Loop over the various components which exist and select the best GCC
// installation available. GCC installs are ranked by version number.
@@ -2233,22 +2214,6 @@
return;
}
- const llvm::Triple &TargetTriple = getTriple();
-
- StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
- if (!CxxIncludeRoot.empty()) {
- StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
- if (CxxIncludeArch.empty())
- CxxIncludeArch = TargetTriple.str();
-
- addLibStdCXXIncludePaths(
- CxxIncludeRoot,
- CxxIncludeArch + (isTarget64Bit() ? CXX_INCLUDE_64BIT_DIR
- : CXX_INCLUDE_32BIT_DIR),
- DriverArgs, CC1Args);
- return;
- }
-
// We need a detected GCC installation on Linux to provide libstdc++'s
// headers. We handled the libc++ case above.
if (!GCCInstallation.isValid())
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=149652&r1=149651&r2=149652&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Thu Feb 2 19:01:20 2012
@@ -329,19 +329,6 @@
void InitHeaderSearch::
AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) {
llvm::Triple::OSType os = triple.getOS();
- StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
- if (CxxIncludeRoot != "") {
- StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
- if (CxxIncludeArch == "")
- AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(),
- CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
- triple);
- else
- AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH,
- CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
- triple);
- return;
- }
// FIXME: temporary hack: hard-coded paths.
if (triple.isOSDarwin()) {
More information about the cfe-commits
mailing list