[PATCH] D70164: [JSONCompilationDatabase] Fix backslash escaping on Windows

liu hui via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 23:11:23 PST 2019


lh123 created this revision.
lh123 added reviewers: sammccall, ilya-biryukov, hokein.
Herald added subscribers: cfe-commits, usaxena95, mstorsjo, kadircet.
Herald added a project: clang.

We should always use `TokenizeWindowsCommandLine` on Windows.

When compiling clangd with `MinGW-W64`, `Triple.getEnvironment` will return `EnvironmentType::GNU`.

fixes https://github.com/clangd/clangd/issues/92.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70164

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,7 @@
     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;
+      Syntax = JSONCommandLineSyntax::Windows;
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70164.229011.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191113/6b68e7c4/attachment-0001.bin>


More information about the cfe-commits mailing list