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;
     }
   }


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;
     }
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to