From f5fbe436bc8ab1f3373deda47300fa8c080a2f9f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 7 Nov 2011 16:02:25 +0000 Subject: Fix an unsafe use of Twine. llvm-svn: 143962 --- clang/lib/Driver/Tools.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'clang') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 88d1e5210ac..64b538d1452 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -157,15 +157,14 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, // the link line. We cannot do the same thing because unlike gcov there is a // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is // not supported by old linkers. - Twine ProfileRT = - Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.a"; + std::string ProfileRT = + std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a"; if (Triple.isOSDarwin()) { // On Darwin, if the static library doesn't exist try the dylib. bool Exists; - if (llvm::sys::fs::exists(ProfileRT.str(), Exists) || !Exists) - ProfileRT = - Twine(TC.getDriver().Dir) + "/../lib/" + "libprofile_rt.dylib"; + if (llvm::sys::fs::exists(ProfileRT, Exists) || !Exists) + ProfileRT.replace(ProfileRT.size() - 1, 1, "dylib"); } CmdArgs.push_back(Args.MakeArgString(ProfileRT)); -- cgit v1.2.3