}
std::string BitcodeCompiler::getThinLTOOutputFile(StringRef path) {
- return lto::getThinLTOOutputFile(
- std::string(path), std::string(ctx.config.thinLTOPrefixReplaceOld),
- std::string(ctx.config.thinLTOPrefixReplaceNew));
+ return lto::getThinLTOOutputFile(path, ctx.config.thinLTOPrefixReplaceOld,
+ ctx.config.thinLTOPrefixReplaceNew);
}
lto::Config BitcodeCompiler::createConfig() {
}
static std::string getThinLTOOutputFile(StringRef modulePath) {
- return lto::getThinLTOOutputFile(
- std::string(modulePath), std::string(config->thinLTOPrefixReplaceOld),
- std::string(config->thinLTOPrefixReplaceNew));
+ return lto::getThinLTOOutputFile(modulePath, config->thinLTOPrefixReplaceOld,
+ config->thinLTOPrefixReplaceNew);
}
static lto::Config createConfig() {
}
static std::string getThinLTOOutputFile(StringRef modulePath) {
- return lto::getThinLTOOutputFile(
- std::string(modulePath), std::string(config->thinLTOPrefixReplaceOld),
- std::string(config->thinLTOPrefixReplaceNew));
+ return lto::getThinLTOOutputFile(modulePath, config->thinLTOPrefixReplaceOld,
+ config->thinLTOPrefixReplaceNew);
}
static lto::Config createConfig() {
/// Given the original \p Path to an output file, replace any path
/// prefix matching \p OldPrefix with \p NewPrefix. Also, create the
/// resulting directory if it does not yet exist.
-std::string getThinLTOOutputFile(const std::string &Path,
- const std::string &OldPrefix,
- const std::string &NewPrefix);
+std::string getThinLTOOutputFile(StringRef Path, StringRef OldPrefix,
+ StringRef NewPrefix);
/// Setup optimization remarks.
Expected<std::unique_ptr<ToolOutputFile>> setupLLVMOptimizationRemarks(
// Given the original \p Path to an output file, replace any path
// prefix matching \p OldPrefix with \p NewPrefix. Also, create the
// resulting directory if it does not yet exist.
-std::string lto::getThinLTOOutputFile(const std::string &Path,
- const std::string &OldPrefix,
- const std::string &NewPrefix) {
+std::string lto::getThinLTOOutputFile(StringRef Path, StringRef OldPrefix,
+ StringRef NewPrefix) {
if (OldPrefix.empty() && NewPrefix.empty())
- return Path;
+ return std::string(Path);
SmallString<128> NewPath(Path);
llvm::sys::path::replace_path_prefix(NewPath, OldPrefix, NewPrefix);
StringRef ParentPath = llvm::sys::path::parent_path(NewPath.str());
MapVector<StringRef, BitcodeModule> &ModuleMap) override {
StringRef ModulePath = BM.getModuleIdentifier();
std::string NewModulePath =
- getThinLTOOutputFile(std::string(ModulePath), OldPrefix, NewPrefix);
+ getThinLTOOutputFile(ModulePath, OldPrefix, NewPrefix);
if (LinkedObjectsFile) {
std::string ObjectPrefix =
NativeObjectPrefix.empty() ? NewPrefix : NativeObjectPrefix;
- std::string LinkedObjectsFilePath = getThinLTOOutputFile(
- std::string(ModulePath), OldPrefix, ObjectPrefix);
+ std::string LinkedObjectsFilePath =
+ getThinLTOOutputFile(ModulePath, OldPrefix, ObjectPrefix);
*LinkedObjectsFile << LinkedObjectsFilePath << '\n';
}
/// Given the original \p Path to an output file, replace any path
/// prefix matching \p OldPrefix with \p NewPrefix. Also, create the
/// resulting directory if it does not yet exist.
-static std::string getThinLTOOutputFile(const std::string &Path,
- const std::string &OldPrefix,
- const std::string &NewPrefix) {
+static std::string getThinLTOOutputFile(StringRef Path, StringRef OldPrefix,
+ StringRef NewPrefix) {
if (OldPrefix.empty() && NewPrefix.empty())
- return Path;
+ return std::string(Path);
SmallString<128> NewPath(Path);
llvm::sys::path::replace_path_prefix(NewPath, OldPrefix, NewPrefix);
StringRef ParentPath = llvm::sys::path::parent_path(NewPath.str());