Skip to content

Commit 4be70dd

Browse files
committed
Switch some of these interfaces from std::string to StringRef and Twine.
This will facilitate further use and recombinations of them. llvm-svn: 143869
1 parent aee36a1 commit 4be70dd

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

clang/lib/Driver/ToolChains.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,9 +1780,8 @@ void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple(
17801780
}
17811781
}
17821782

1783-
static void addPathIfExists(const std::string &Path,
1784-
ToolChain::path_list &Paths) {
1785-
if (llvm::sys::fs::exists(Path)) Paths.push_back(Path);
1783+
static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
1784+
if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
17861785
}
17871786

17881787
/// \brief Get our best guess at the multiarch triple for a target.
@@ -1823,8 +1822,8 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
18231822
// OpenSuse stores the linker with the compiler, add that to the search
18241823
// path.
18251824
ToolChain::path_list &PPaths = getProgramPaths();
1826-
PPaths.push_back(GCCInstallation.getParentLibPath() + "/../" +
1827-
GCCInstallation.getTriple() + "/bin");
1825+
PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
1826+
GCCInstallation.getTriple() + "/bin").str());
18281827

18291828
Linker = GetProgramPath("ld");
18301829

clang/lib/Driver/ToolChains.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
396396
bool isValid() const { return IsValid; }
397397

398398
/// \brief Get the GCC triple for the detected install.
399-
const std::string &getTriple() const { return GccTriple; }
399+
StringRef getTriple() const { return GccTriple; }
400400

401401
/// \brief Get the detected GCC installation path.
402-
const std::string &getInstallPath() const { return GccInstallPath; }
402+
StringRef getInstallPath() const { return GccInstallPath; }
403403

404404
/// \brief Get the detected GCC parent lib path.
405-
const std::string &getParentLibPath() const { return GccParentLibPath; }
405+
StringRef getParentLibPath() const { return GccParentLibPath; }
406406

407407
private:
408408
static void CollectLibDirsAndTriples(llvm::Triple::ArchType HostArch,

0 commit comments

Comments
 (0)