diff options
Diffstat (limited to 'lld/ELF/InputFiles.h')
-rw-r--r-- | lld/ELF/InputFiles.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index dbd464394a2..81421217112 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -355,6 +355,20 @@ inline bool isBitcode(MemoryBufferRef MB) { return identify_magic(MB.getBuffer()) == llvm::file_magic::bitcode; } +inline std::string updateSuffixInPath(llvm::StringRef Path) { + if (Path.endswith(Config->ThinLTOObjectSuffixReplace.first)) { + size_t pos = Path.rfind(Config->ThinLTOObjectSuffixReplace.first); + std::string SuffixedPath = + (Path.str().substr(0, pos) + + Config->ThinLTOObjectSuffixReplace.second.str()); + return SuffixedPath; + } else { + error("cannot find suffix " + + Config->ThinLTOObjectSuffixReplace.first.str()); + return ""; + } +} + extern std::vector<BinaryFile *> BinaryFiles; extern std::vector<BitcodeFile *> BitcodeFiles; extern std::vector<LazyObjFile *> LazyObjFiles; |