From 4e35fa54a617ab888c85de2425c2aa5dd62d1a30 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 17 May 2016 18:43:22 +0000 Subject: [PATCH] [ThinLTO] Use semicolon to separate path prefix replacement Summary: Colons can appear in Windows paths after drive letters. Both colon and semicolon are valid characters in filenames, but neither are very common. Semicolon seems just as good, and makes the test pass on Windows. Reviewers: tejohnson Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D20332 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269798 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/ThinLTO/X86/prefix_replace.ll | 3 +-- test/tools/gold/X86/thinlto_prefix_replace.ll | 2 +- tools/gold/gold-plugin.cpp | 8 ++++---- tools/llvm-lto/llvm-lto.cpp | 6 +++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test/ThinLTO/X86/prefix_replace.ll b/test/ThinLTO/X86/prefix_replace.ll index 16664c2a87c..c2c125c2f1c 100644 --- a/test/ThinLTO/X86/prefix_replace.ll +++ b/test/ThinLTO/X86/prefix_replace.ll @@ -1,6 +1,5 @@ ; Check that changing the output path via prefix-replace works ; Use of '/' in paths created here make this unsuitable for Windows. -; REQUIRES: shell ; RUN: mkdir -p %T/oldpath ; RUN: opt -module-summary %s -o %T/oldpath/prefix_replace.o ; Ensure that there is no existing file at the new path, so we properly @@ -8,7 +7,7 @@ ; RUN: rm -f %T/newpath/prefix_replace.o.thinlto.bc ; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %T/oldpath/prefix_replace.o -; RUN: llvm-lto -thinlto-action=distributedindexes -thinlto-prefix-replace="%T/oldpath/:%T/newpath/" -thinlto-index %t.index.bc %T/oldpath/prefix_replace.o +; RUN: llvm-lto -thinlto-action=distributedindexes -thinlto-prefix-replace="%T/oldpath/;%T/newpath/" -thinlto-index %t.index.bc %T/oldpath/prefix_replace.o ; RUN: ls %T/newpath/prefix_replace.o.thinlto.bc diff --git a/test/tools/gold/X86/thinlto_prefix_replace.ll b/test/tools/gold/X86/thinlto_prefix_replace.ll index 5727d96c1f4..a635088a460 100644 --- a/test/tools/gold/X86/thinlto_prefix_replace.ll +++ b/test/tools/gold/X86/thinlto_prefix_replace.ll @@ -7,7 +7,7 @@ ; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ ; RUN: --plugin-opt=thinlto \ ; RUN: --plugin-opt=thinlto-index-only \ -; RUN: --plugin-opt=thinlto-prefix-replace="%T/oldpath/:%T/newpath/" \ +; RUN: --plugin-opt=thinlto-prefix-replace="%T/oldpath/;%T/newpath/" \ ; RUN: -shared %T/oldpath/thinlto_prefix_replace.o -o %T/thinlto_prefix_replace ; RUN: ls %T/newpath/thinlto_prefix_replace.o.thinlto.bc diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 2440529d52b..9fdf52e5922 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -234,8 +234,8 @@ namespace options { thinlto_emit_imports_files = true; } else if (opt.startswith("thinlto-prefix-replace=")) { thinlto_prefix_replace = opt.substr(strlen("thinlto-prefix-replace=")); - if (thinlto_prefix_replace.find(":") == std::string::npos) - message(LDPL_FATAL, "thinlto-prefix-replace expects 'old:new' format"); + if (thinlto_prefix_replace.find(";") == std::string::npos) + message(LDPL_FATAL, "thinlto-prefix-replace expects 'old;new' format"); } else if (opt.size() == 2 && opt[0] == 'O') { if (opt[1] < '0' || opt[1] > '3') message(LDPL_FATAL, "Optimization level must be between 0 and 3"); @@ -1219,8 +1219,8 @@ static void thinLTOBackends(raw_fd_ostream *ApiFile, static void getThinLTOOldAndNewPrefix(std::string &OldPrefix, std::string &NewPrefix) { StringRef PrefixReplace = options::thinlto_prefix_replace; - assert(PrefixReplace.empty() || PrefixReplace.find(":") != StringRef::npos); - std::pair Split = PrefixReplace.split(":"); + assert(PrefixReplace.empty() || PrefixReplace.find(";") != StringRef::npos); + std::pair Split = PrefixReplace.split(";"); OldPrefix = Split.first.str(); NewPrefix = Split.second.str(); } diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp index fe3f1b7de91..83733b4501f 100644 --- a/tools/llvm-lto/llvm-lto.cpp +++ b/tools/llvm-lto/llvm-lto.cpp @@ -108,7 +108,7 @@ static cl::opt static cl::opt ThinLTOPrefixReplace( "thinlto-prefix-replace", cl::desc("Control where files for distributed backends are " - "created. Expects 'oldprefix:newprefix' and if path " + "created. Expects 'oldprefix;newprefix' and if path " "prefix of output file is oldprefix it will be " "replaced with newprefix.")); @@ -307,9 +307,9 @@ static void createCombinedModuleSummaryIndex() { static void getThinLTOOldAndNewPrefix(std::string &OldPrefix, std::string &NewPrefix) { assert(ThinLTOPrefixReplace.empty() || - ThinLTOPrefixReplace.find(":") != StringRef::npos); + ThinLTOPrefixReplace.find(";") != StringRef::npos); StringRef PrefixReplace = ThinLTOPrefixReplace; - std::pair Split = PrefixReplace.split(":"); + std::pair Split = PrefixReplace.split(";"); OldPrefix = Split.first.str(); NewPrefix = Split.second.str(); }