[cfe-commits] r143869 - in /cfe/trunk/lib/Driver: ToolChains.cpp ToolChains.h

Chandler Carruth chandlerc at gmail.com
Sun Nov 6 01:21:54 PST 2011


Author: chandlerc
Date: Sun Nov  6 03:21:54 2011
New Revision: 143869

URL: http://llvm.org/viewvc/llvm-project?rev=143869&view=rev
Log:
Switch some of these interfaces from std::string to StringRef and Twine.
This will facilitate further use and recombinations of them.

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=143869&r1=143868&r2=143869&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sun Nov  6 03:21:54 2011
@@ -1780,9 +1780,8 @@
   }
 }
 
-static void addPathIfExists(const std::string &Path,
-                            ToolChain::path_list &Paths) {
-  if (llvm::sys::fs::exists(Path)) Paths.push_back(Path);
+static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
+  if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
 }
 
 /// \brief Get our best guess at the multiarch triple for a target.
@@ -1823,8 +1822,8 @@
   // OpenSuse stores the linker with the compiler, add that to the search
   // path.
   ToolChain::path_list &PPaths = getProgramPaths();
-  PPaths.push_back(GCCInstallation.getParentLibPath() + "/../" +
-                   GCCInstallation.getTriple() + "/bin");
+  PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
+                         GCCInstallation.getTriple() + "/bin").str());
 
   Linker = GetProgramPath("ld");
 

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=143869&r1=143868&r2=143869&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Sun Nov  6 03:21:54 2011
@@ -396,13 +396,13 @@
     bool isValid() const { return IsValid; }
 
     /// \brief Get the GCC triple for the detected install.
-    const std::string &getTriple() const { return GccTriple; }
+    StringRef getTriple() const { return GccTriple; }
 
     /// \brief Get the detected GCC installation path.
-    const std::string &getInstallPath() const { return GccInstallPath; }
+    StringRef getInstallPath() const { return GccInstallPath; }
 
     /// \brief Get the detected GCC parent lib path.
-    const std::string &getParentLibPath() const { return GccParentLibPath; }
+    StringRef getParentLibPath() const { return GccParentLibPath; }
 
   private:
     static void CollectLibDirsAndTriples(llvm::Triple::ArchType HostArch,





More information about the cfe-commits mailing list