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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Note that I found this due to a report of a crash in clangd, but I don't actually use that so just looked through the code for what was messing with paths. Users on that bug report confirmed that this fixed their issue, but there's probably still a crash somewhere on "bad" input.
Also, I don't have push access so someone would need to push this for me assuming it is approved.
This looks ok to me I guess. Technically in this case, this is pretty much equivalent to #ifdef _WIN32, i.e. any form when running on windows, where the process considers itself windows (cygwin doesn't define _WIN32), but I guess keeping it based on getProcessTriple() is fine too.
I'll leave it open for discussion for a while, but if there's no further opinions I can accept it later.
@rnk Do you happen to have any experience here?
I think the largest producer of JSON compilation databases with untokenized command line strings is CMake. If CMake uses Windows quoting rules to build up command lines, then clang should make the same assumption.
clang/lib/Tooling/JSONCompilationDatabase.cpp | ||
---|---|---|
142–143 | This seems like it can be simplified to: Syntax = (Triple.isOSWindows() && !Triple.isWindowsCygwinEnvironment()) ? JSONCommandLineSyntax::Windows : JSONCommandLineSyntax::Gnu; Alternatively, the ifdef _WIN32 would work. |
This seems like it can be simplified to:
Alternatively, the ifdef _WIN32 would work.