Skip to content

Commit

Permalink
Switch some of these interfaces from std::string to StringRef and Twine.
Browse files Browse the repository at this point in the history
This will facilitate further use and recombinations of them.

llvm-svn: 143869
  • Loading branch information
chandlerc committed Nov 6, 2011
1 parent aee36a1 commit 4be70dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions clang/lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1780,9 +1780,8 @@ void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple(
}
}

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.
Expand Down Expand Up @@ -1823,8 +1822,8 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
// 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");

Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Driver/ToolChains.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,13 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
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,
Expand Down

0 comments on commit 4be70dd

Please sign in to comment.