[clang] d9b9a7f - [clang][Tooling] Use Windows command lines on all Windows, except Cygwin

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 13 12:56:06 PDT 2021


Author: Jeremy Drake
Date: 2021-10-13T22:55:14+03:00
New Revision: d9b9a7f4287019ad7fb5ae35523e81dee36c1b40

URL: https://github.com/llvm/llvm-project/commit/d9b9a7f4287019ad7fb5ae35523e81dee36c1b40
DIFF: https://github.com/llvm/llvm-project/commit/d9b9a7f4287019ad7fb5ae35523e81dee36c1b40.diff

LOG: [clang][Tooling] Use Windows command lines on all Windows, except Cygwin

Previously it only used Windows command lines for MSVC triples, but this
was causing issues for windows-gnu.  In fact, everything 'native' Windows
(ie, not Cygwin) should use Windows command line parsing.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D111195

Added: 
    

Modified: 
    clang/lib/Tooling/JSONCompilationDatabase.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp
index 97ba7e411fbb..5e18d7a576c0 100644
--- a/clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -135,15 +135,12 @@ class CommandLineArgumentParser {
 std::vector<std::string> unescapeCommandLine(JSONCommandLineSyntax Syntax,
                                              StringRef EscapedCommandLine) {
   if (Syntax == JSONCommandLineSyntax::AutoDetect) {
+#ifdef _WIN32
+    // Assume Windows command line parsing on Win32
+    Syntax = JSONCommandLineSyntax::Windows;
+#else
     Syntax = JSONCommandLineSyntax::Gnu;
-    llvm::Triple Triple(llvm::sys::getProcessTriple());
-    if (Triple.getOS() == llvm::Triple::OSType::Win32) {
-      // Assume Windows command line parsing on Win32 unless the triple
-      // explicitly tells us otherwise.
-      if (!Triple.hasEnvironment() ||
-          Triple.getEnvironment() == llvm::Triple::EnvironmentType::MSVC)
-        Syntax = JSONCommandLineSyntax::Windows;
-    }
+#endif
   }
 
   if (Syntax == JSONCommandLineSyntax::Windows) {


        


More information about the cfe-commits mailing list