summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-07-18 21:38:44 +0000
committerRui Ueyama <ruiu@google.com>2013-07-18 21:38:44 +0000
commit4227022673d0cbd155ea708b3e276ab95635e6fe (patch)
tree8128bd112bfbe86fb69e20edd2010437e61d3838
parent0d1a53e13b1d21e95f998c4bc7c9032a40b8f88b (diff)
downloadbcm5719-llvm-4227022673d0cbd155ea708b3e276ab95635e6fe.tar.gz
bcm5719-llvm-4227022673d0cbd155ea708b3e276ab95635e6fe.zip
[PECOFF] Use replace_extension() instead of doing it myself.
llvm-svn: 186612
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 873dfb159bf..0eff1b27384 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -15,6 +15,7 @@
#include <cstdlib>
+#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/Option.h"
@@ -175,11 +176,10 @@ StringRef canonicalizeInputFileName(PECOFFTargetInfo &info, std::string path) {
// Replace a file extension with ".exe". If the given file has no
// extension, just add ".exe".
-StringRef getDefaultOutputFileName(PECOFFTargetInfo &info, std::string path) {
- StringRef ext = llvm::sys::path::extension(path);
- if (!ext.empty())
- path.erase(path.size() - ext.size());
- return info.allocateString(path.append(".exe"));
+StringRef getDefaultOutputFileName(PECOFFTargetInfo &info, StringRef path) {
+ SmallString<128> smallStr = path;
+ llvm::sys::path::replace_extension(smallStr, ".exe");
+ return info.allocateString(smallStr.str());
}
} // namespace
OpenPOWER on IntegriCloud