[PATCH] D20332: [ThinLTO] Use semicolon to separate path prefix replacement

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 09:42:52 PDT 2016


rnk created this revision.
rnk added a reviewer: tejohnson.
rnk added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

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.

http://reviews.llvm.org/D20332

Files:
  test/ThinLTO/X86/prefix_replace.ll
  tools/gold/gold-plugin.cpp
  tools/llvm-lto/llvm-lto.cpp

Index: tools/llvm-lto/llvm-lto.cpp
===================================================================
--- tools/llvm-lto/llvm-lto.cpp
+++ tools/llvm-lto/llvm-lto.cpp
@@ -307,9 +307,9 @@
 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<StringRef, StringRef> Split = PrefixReplace.split(":");
+  std::pair<StringRef, StringRef> Split = PrefixReplace.split(";");
   OldPrefix = Split.first.str();
   NewPrefix = Split.second.str();
 }
Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -234,8 +234,8 @@
       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");
Index: test/ThinLTO/X86/prefix_replace.ll
===================================================================
--- test/ThinLTO/X86/prefix_replace.ll
+++ test/ThinLTO/X86/prefix_replace.ll
@@ -1,14 +1,13 @@
 ; 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
 ; test the creation of the new file there.
 ; 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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20332.57492.patch
Type: text/x-patch
Size: 2645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160517/b54d88f7/attachment.bin>


More information about the llvm-commits mailing list