diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-11-07 16:02:25 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-11-07 16:02:25 +0000 |
commit | f2db04c49429a6d53069b813d42999fa36ddd9a4 (patch) | |
tree | 39027b0aad1315b9fa06b70235c86016347ece6d /lib/Driver/Tools.cpp | |
parent | cc5d4f637cdf83adc174b96d2bfe27cef1cf0f36 (diff) |
Fix an unsafe use of Twine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 88d1e5210a..64b538d145 100644 --- a/lib/Driver/Tools.cpp +++ b/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)); |