mstorsjo created this revision.
mstorsjo added reviewers: rnk, hans, smeenai, thakis.
Herald added a project: clang.

Path lists on windows should always be separated by semicolons, not colons. 
Reuse llvm::sys::EnvPathSeparator for this purpose (as that's also a path list 
that is separated in the same way).

Alternatively, this could just be a local ifdef _WIN32 in this function, or 
should we generalize the existing EnvPathSeparator to e.g. a 
llvm::sys::path::PathListSeparator?

Does this change need a test? I guess we could add a separate file with 
"REQUIRES: system-windows" and check if the output does contain a semicolon, 
but I'm not sure how meaningful that is, especially as the default list printed 
only contains one single path element.

This was noted within Qt (and worked around with a creative regex) at 
https://codereview.qt-project.org/247331.


Repository:
  rC Clang

https://reviews.llvm.org/D61121

Files:
  lib/Driver/Driver.cpp


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1694,7 +1694,7 @@
     bool separator = false;
     for (const std::string &Path : TC.getProgramPaths()) {
       if (separator)
-        llvm::outs() << ':';
+        llvm::outs() << llvm::sys::EnvPathSeparator;
       llvm::outs() << Path;
       separator = true;
     }
@@ -1705,7 +1705,7 @@
 
     for (const std::string &Path : TC.getFilePaths()) {
       // Always print a separator. ResourceDir was the first item shown.
-      llvm::outs() << ':';
+      llvm::outs() << llvm::sys::EnvPathSeparator;
       // Interpretation of leading '=' is needed only for NetBSD.
       if (Path[0] == '=')
         llvm::outs() << sysroot << Path.substr(1);


Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1694,7 +1694,7 @@
     bool separator = false;
     for (const std::string &Path : TC.getProgramPaths()) {
       if (separator)
-        llvm::outs() << ':';
+        llvm::outs() << llvm::sys::EnvPathSeparator;
       llvm::outs() << Path;
       separator = true;
     }
@@ -1705,7 +1705,7 @@
 
     for (const std::string &Path : TC.getFilePaths()) {
       // Always print a separator. ResourceDir was the first item shown.
-      llvm::outs() << ':';
+      llvm::outs() << llvm::sys::EnvPathSeparator;
       // Interpretation of leading '=' is needed only for NetBSD.
       if (Path[0] == '=')
         llvm::outs() << sysroot << Path.substr(1);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to