From d9b9a7f4287019ad7fb5ae35523e81dee36c1b40 Mon Sep 17 00:00:00 2001 From: Jeremy Drake Date: Wed, 13 Oct 2021 22:49:29 +0300 Subject: [PATCH] [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 --- clang/lib/Tooling/JSONCompilationDatabase.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 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) { -- 2.34.1