sbc100 created this revision.
Herald added subscribers: cfe-commits, sunfish, aheejin.
Herald added a project: clang.
sbc100 added a reviewer: ruiu.

This matches other tools such as llvm-ar, lld, etc.

This consistency is useful when authoring downstream tools as it means
they can always use windows-style response files on windows, rather than
generate a different style for clang compared to the other tools.

This was discussed in the equivalent llvm-ar change:

  https://reviews.llvm.org/D69665

wasm-ld behaviour was changed there:

  https://reviews.llvm.org/D75577


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80876

Files:
  clang/tools/driver/driver.cpp


Index: clang/tools/driver/driver.cpp
===================================================================
--- clang/tools/driver/driver.cpp
+++ clang/tools/driver/driver.cpp
@@ -385,10 +385,22 @@
   bool MarkEOLs = ClangCLMode;
 
   llvm::cl::TokenizerCallback Tokenizer;
-  if (RSPQuoting == Windows || (RSPQuoting == Default && ClangCLMode))
+  switch (RSPQuoting) {
+  case Default: {
+    if (ClangCLMode ||
+        llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows())
+      Tokenizer = &llvm::cl::TokenizeWindowsCommandLine;
+    else
+      Tokenizer = &llvm::cl::TokenizeGNUCommandLine;
+    break;
+  }
+  case Windows:
     Tokenizer = &llvm::cl::TokenizeWindowsCommandLine;
-  else
+    break;
+  case POSIX:
     Tokenizer = &llvm::cl::TokenizeGNUCommandLine;
+    break;
+  }
 
   if (MarkEOLs && argv.size() > 1 && StringRef(argv[1]).startswith("-cc1"))
     MarkEOLs = false;


Index: clang/tools/driver/driver.cpp
===================================================================
--- clang/tools/driver/driver.cpp
+++ clang/tools/driver/driver.cpp
@@ -385,10 +385,22 @@
   bool MarkEOLs = ClangCLMode;
 
   llvm::cl::TokenizerCallback Tokenizer;
-  if (RSPQuoting == Windows || (RSPQuoting == Default && ClangCLMode))
+  switch (RSPQuoting) {
+  case Default: {
+    if (ClangCLMode ||
+        llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows())
+      Tokenizer = &llvm::cl::TokenizeWindowsCommandLine;
+    else
+      Tokenizer = &llvm::cl::TokenizeGNUCommandLine;
+    break;
+  }
+  case Windows:
     Tokenizer = &llvm::cl::TokenizeWindowsCommandLine;
-  else
+    break;
+  case POSIX:
     Tokenizer = &llvm::cl::TokenizeGNUCommandLine;
+    break;
+  }
 
   if (MarkEOLs && argv.size() > 1 && StringRef(argv[1]).startswith("-cc1"))
     MarkEOLs = false;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [P... Sam Clegg via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Sam Clegg via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Paul Robinson via Phabricator via cfe-commits
    • ... Reid "Away June-Sep" Kleckner via Phabricator via cfe-commits
    • ... Martin Storsjö via Phabricator via cfe-commits
    • ... Martin Storsjö via Phabricator via cfe-commits

Reply via email to