[cfe-commits] r148843 - in /cfe/trunk/lib/Driver: ToolChains.cpp ToolChains.h
Chandler Carruth
chandlerc at gmail.com
Tue Jan 24 11:28:29 PST 2012
Author: chandlerc
Date: Tue Jan 24 13:28:29 2012
New Revision: 148843
URL: http://llvm.org/viewvc/llvm-project?rev=148843&view=rev
Log:
Address one part of the FIXME I introduced my switching the triple
inside of GCCInstallation to be a proper llvm::Triple. This is still
a touch ugly because we have to use it as a string in so many places,
but I think on the whole the more structured representation is better.
Comments of course welcome if this tradeoff isn't working for folks.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=148843&r1=148842&r2=148843&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Jan 24 13:28:29 2012
@@ -1100,9 +1100,8 @@
Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(const Driver &D)
: IsValid(false),
// FIXME: GCCTriple is using the target triple as both the target and host
- // triple here. It also shouldn't be using the string representation, and
- // should instead be using the Triple object.
- GCCTriple(D.TargetTriple.str()) {
+ // triple here.
+ GCCTriple(D.TargetTriple) {
// 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
@@ -1131,7 +1130,7 @@
return;
}
- llvm::Triple::ArchType HostArch = llvm::Triple(GCCTriple).getArch();
+ llvm::Triple::ArchType HostArch = GCCTriple.getArch();
// The library directories which may contain GCC installations.
SmallVector<StringRef, 4> CandidateLibDirs;
// The compatible GCC triples for this particular architecture.
@@ -1296,7 +1295,7 @@
continue;
Version = CandidateVersion;
- GCCTriple = CandidateTriple.str();
+ GCCTriple.setTriple(CandidateTriple);
// FIXME: We hack together the directory name here instead of
// using LI to ensure stable path separators across Windows and
// Linux.
@@ -1906,7 +1905,7 @@
// path.
ToolChain::path_list &PPaths = getProgramPaths();
PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
- GCCInstallation.getTriple() + "/bin").str());
+ GCCInstallation.getTriple().str() + "/bin").str());
Linker = GetProgramPath("ld");
@@ -1983,9 +1982,9 @@
// Add the multilib suffixed paths where they are available.
if (GCCInstallation.isValid()) {
const std::string &LibPath = GCCInstallation.getParentLibPath();
- const std::string &GCCTriple = GCCInstallation.getTriple();
+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
addPathIfExists(GCCInstallation.getInstallPath() + Suffix, Paths);
- addPathIfExists(LibPath + "/../" + GCCTriple + "/lib/../" + Multilib,
+ addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib/../" + Multilib,
Paths);
addPathIfExists(LibPath + "/" + MultiarchTriple, Paths);
addPathIfExists(LibPath + "/../" + Multilib, Paths);
@@ -1998,16 +1997,16 @@
// Try walking via the GCC triple path in case of multiarch GCC
// installations with strange symlinks.
if (GCCInstallation.isValid())
- addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple() +
+ addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
"/../../" + Multilib, Paths);
// Add the non-multilib suffixed paths (if potentially different).
if (GCCInstallation.isValid()) {
const std::string &LibPath = GCCInstallation.getParentLibPath();
- const std::string &GCCTriple = GCCInstallation.getTriple();
+ const llvm::Triple &GCCTriple = GCCInstallation.getTriple();
if (!Suffix.empty())
addPathIfExists(GCCInstallation.getInstallPath(), Paths);
- addPathIfExists(LibPath + "/../" + GCCTriple + "/lib", Paths);
+ addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib", Paths);
addPathIfExists(LibPath, Paths);
}
addPathIfExists(SysRoot + "/lib", Paths);
@@ -2208,12 +2207,12 @@
StringRef InstallDir = GCCInstallation.getInstallPath();
StringRef Version = GCCInstallation.getVersion();
if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version,
- GCCInstallation.getTriple() + Suffix,
+ GCCInstallation.getTriple().str() + Suffix,
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() + Suffix,
+ GCCInstallation.getTriple().str() + Suffix,
DriverArgs, CC1Args);
}
}
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=148843&r1=148842&r2=148843&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Jan 24 13:28:29 2012
@@ -69,7 +69,7 @@
class GCCInstallationDetector {
bool IsValid;
- std::string GCCTriple;
+ llvm::Triple GCCTriple;
// FIXME: These might be better as path objects.
std::string GCCInstallPath;
@@ -84,7 +84,7 @@
bool isValid() const { return IsValid; }
/// \brief Get the GCC triple for the detected install.
- StringRef getTriple() const { return GCCTriple; }
+ const llvm::Triple &getTriple() const { return GCCTriple; }
/// \brief Get the detected GCC installation path.
StringRef getInstallPath() const { return GCCInstallPath; }
More information about the cfe-commits
mailing list