[PATCH] D51060: [gold] -thinlto-object-suffix-replace: don't append new suffix if path does not end with old suffix
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 21 13:02:19 PDT 2018
MaskRay created this revision.
MaskRay added a reviewer: tejohnson.
Herald added subscribers: llvm-commits, dexonsmith, inglorion.
Repository:
rL LLVM
https://reviews.llvm.org/D51060
Files:
tools/gold/gold-plugin.cpp
Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -667,13 +667,9 @@
/// suffix matching \p OldSuffix with \p NewSuffix.
static std::string getThinLTOObjectFileName(StringRef Path, StringRef OldSuffix,
StringRef NewSuffix) {
- if (OldSuffix.empty() && NewSuffix.empty())
- return Path;
- StringRef NewPath = Path;
- NewPath.consume_back(OldSuffix);
- std::string NewNewPath = NewPath;
- NewNewPath += NewSuffix;
- return NewNewPath;
+ if (Path.consume_back(OldSuffix))
+ return (Path + NewSuffix).str();
+ return Path;
}
// Returns true if S is valid as a C language identifier.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51060.161804.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180821/3ff6edf6/attachment.bin>
More information about the llvm-commits
mailing list