[cfe-commits] r84115 - in /cfe/trunk: include/clang/Frontend/InitHeaderSearch.h lib/Frontend/InitHeaderSearch.cpp
Rafael Espindola
rafael.espindola at gmail.com
Wed Oct 14 10:09:45 PDT 2009
Author: rafael
Date: Wed Oct 14 12:09:44 2009
New Revision: 84115
URL: http://llvm.org/viewvc/llvm-project?rev=84115&view=rev
Log:
Add support for having different c++ search dirs with -m32 and -m64. So far
this is only used in darwin10, 64 bit ubuntu 9.10 and 64 bit openSUSE 11.1.
Modified:
cfe/trunk/include/clang/Frontend/InitHeaderSearch.h
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Modified: cfe/trunk/include/clang/Frontend/InitHeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/InitHeaderSearch.h?rev=84115&r1=84114&r2=84115&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/InitHeaderSearch.h (original)
+++ cfe/trunk/include/clang/Frontend/InitHeaderSearch.h Wed Oct 14 12:09:44 2009
@@ -59,7 +59,9 @@
/// AddGnuCPlusPlusIncludePaths - Add the necessary paths to suport a gnu
/// libstdc++.
- void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Arch);
+ void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple);
/// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to suport a MinGW
/// libstdc++.
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=84115&r1=84114&r2=84115&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Wed Oct 14 12:09:44 2009
@@ -103,10 +103,18 @@
}
void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(const std::string &Base,
- const char *Arch) {
- AddPath(Base, System, true, false, false);
- AddPath(Base + "/" + Arch, System, true, false, false);
- AddPath(Base + "/backward", System, true, false, false);
+ const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple) {
+ llvm::Triple::ArchType arch = triple.getArch();
+ bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
+
+ AddPath(Base, System, true, false, false);
+ if (is64bit)
+ AddPath(Base + "/" + Dir64, System, true, false, false);
+ else
+ AddPath(Base + "/" + Dir32, System, true, false, false);
+ AddPath(Base + "/backward", System, true, false, false);
}
void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(const std::string &Base,
@@ -234,7 +242,7 @@
}
void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang,
- const llvm::Triple &triple) {
+ const llvm::Triple &triple) {
// FIXME: temporary hack: hard-coded paths.
llvm::Triple::OSType os = triple.getOS();
@@ -299,56 +307,91 @@
switch (os) {
case llvm::Triple::Darwin:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
- "i686-apple-darwin10");
+ "i686-apple-darwin10",
+ "i686-apple-darwin10/x86_64",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
- "i686-apple-darwin8");
+ "i686-apple-darwin8",
+ "i686-apple-darwin8",
+ triple);
break;
case llvm::Triple::Linux:
// Ubuntu 7.10 - Gutsy Gibbon
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.3",
- "i486-linux-gnu");
+ "i486-linux-gnu",
+ "i486-linux-gnu",
+ triple);
// Ubuntu 9.04
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.3",
- "x86_64-linux-gnu");
+ "x86_64-linux-gnu/32",
+ "x86_64-linux-gnu",
+ triple);
// Fedora 8
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
- "i386-redhat-linux");
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
// Fedora 9
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
- "i386-redhat-linux");
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
// Fedora 10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
- "i386-redhat-linux");
- // openSUSE 11.1
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
+ // openSUSE 11.1 32 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "i586-suse-linux");
+ "i586-suse-linux",
+ "i586-suse-linux",
+ triple);
+ // openSUSE 11.1 64 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "x86_64-suse-linux");
+ "x86_64-suse-linux/32",
+ "x86_64-suse-linux",
+ triple);
// openSUSE 11.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
- "i586-suse-linux");
+ "i586-suse-linux",
+ "i586-suse-linux",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
- "x86_64-suse-linux");
+ "x86_64-suse-linux",
+ "x86_64-suse-linux",
+ triple);
// Arch Linux 2008-06-24
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
- "x86_64-unknown-linux-gnu");
+ "x86_64-unknown-linux-gnu",
+ "x86_64-unknown-linux-gnu",
+ triple);
// Gentoo x86 2009.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
// Gentoo x86 2008.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
// Ubuntu 8.10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "i486-pc-linux-gnu");
+ "i486-pc-linux-gnu",
+ "i486-pc-linux-gnu",
+ triple);
// Gentoo amd64 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
break;
case llvm::Triple::FreeBSD:
// DragonFly
@@ -359,7 +402,9 @@
case llvm::Triple::Solaris:
// AuroraUX
AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4",
- "i386-pc-solaris2.11");
+ "i386-pc-solaris2.11",
+ "i386-pc-solaris2.11",
+ triple);
break;
default:
break;
More information about the cfe-commits
mailing list