[PATCH] D121687: [clang-tidy] Don't try to build CTTestTidyModule for Windows with dylibs

2022-03-25 Thread Jeremy Drake via Phabricator via cfe-commits
jeremyd2019 added inline comments.



Comment at: clang-tools-extra/test/CMakeLists.txt:84
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-  llvm_add_library(
-  CTTestTidyModule
-  MODULE clang-tidy/CTTestTidyModule.cpp
-  PLUGIN_TOOL clang-tidy
-  DEPENDS clang-tidy-headers)
+  if (NOT WIN32 AND NOT LLVM_LINK_LLVM_DYLIB)
+llvm_add_library(

I only just noticed this patch, but it feels to me like this was intended to be 
OR here, because the condition to be avoided seems to be `WIN32 AND 
LLVM_LINK_LLVM_DYLIB`, which inverted is `NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121687/new/

https://reviews.llvm.org/D121687

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2021-10-05 Thread Jeremy Drake via Phabricator via cfe-commits
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/D95

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


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

2021-10-05 Thread Jeremy Drake via Phabricator via cfe-commits
jeremyd2019 added a comment.

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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95/new/

https://reviews.llvm.org/D95

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2021-10-05 Thread Jeremy Drake via Phabricator via cfe-commits
jeremyd2019 added a comment.

Also, I don't have push access so someone would need to push this for me 
assuming it is approved.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95/new/

https://reviews.llvm.org/D95

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2021-10-06 Thread Jeremy Drake via Phabricator via cfe-commits
jeremyd2019 updated this revision to Diff 377590.
jeremyd2019 added a comment.

Switched to #ifdef _WIN32 instead of checking triple


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95/new/

https://reviews.llvm.org/D95

Files:
  clang/lib/Tooling/JSONCompilationDatabase.cpp


Index: clang/lib/Tooling/JSONCompilationDatabase.cpp
===
--- clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -135,15 +135,12 @@
 std::vector 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) {


Index: clang/lib/Tooling/JSONCompilationDatabase.cpp
===
--- clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -135,15 +135,12 @@
 std::vector 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) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits