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

Jeremy Drake via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 5 16:45:35 PDT 2021


jeremyd2019 created this revision.
jeremyd2019 added reviewers: mstorsjo, rsmith.
jeremyd2019 added a project: clang.
jeremyd2019 requested review of this revision.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111195

Files:
  clang/lib/Tooling/JSONCompilationDatabase.cpp


Index: clang/lib/Tooling/JSONCompilationDatabase.cpp
===================================================================
--- clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -137,11 +137,10 @@
   if (Syntax == JSONCommandLineSyntax::AutoDetect) {
     Syntax = JSONCommandLineSyntax::Gnu;
     llvm::Triple Triple(llvm::sys::getProcessTriple());
-    if (Triple.getOS() == llvm::Triple::OSType::Win32) {
+    if (Triple.isOSWindows()) {
       // Assume Windows command line parsing on Win32 unless the triple
       // explicitly tells us otherwise.
-      if (!Triple.hasEnvironment() ||
-          Triple.getEnvironment() == llvm::Triple::EnvironmentType::MSVC)
+      if (!Triple.isWindowsCygwinEnvironment())
         Syntax = JSONCommandLineSyntax::Windows;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111195.377385.patch
Type: text/x-patch
Size: 826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211005/c249dff4/attachment-0001.bin>


More information about the cfe-commits mailing list