summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 6c55ebcddc4..239460d972d 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -667,13 +667,9 @@ static void getThinLTOOldAndNewSuffix(std::string &OldSuffix,
/// 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.
OpenPOWER on IntegriCloud