aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/JSONCompilationDatabase.cpp
diff options
context:
space:
mode:
authorJeremy Drake <github@jdrake.com>2021-10-13 22:49:29 +0300
committerMartin Storsjö <martin@martin.st>2021-10-13 22:55:14 +0300
commitd9b9a7f4287019ad7fb5ae35523e81dee36c1b40 (patch)
treee4d7e88021145c85cd5b07db3f306e6afef64ae6 /clang/lib/Tooling/JSONCompilationDatabase.cpp
parenta03e17d4d9419811da16bc2e893fd0cf9b8aa2a7 (diff)
downloadllvm-d9b9a7f4287019ad7fb5ae35523e81dee36c1b40.zip
llvm-d9b9a7f4287019ad7fb5ae35523e81dee36c1b40.tar.gz
llvm-d9b9a7f4287019ad7fb5ae35523e81dee36c1b40.tar.bz2
[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
Diffstat (limited to 'clang/lib/Tooling/JSONCompilationDatabase.cpp')
-rw-r--r--clang/lib/Tooling/JSONCompilationDatabase.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp
index 97ba7e4..5e18d7a 100644
--- a/clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -135,15 +135,12 @@ class CommandLineArgumentParser {
std::vector<std::string> 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) {