[libcxx-commits] [libcxx] [libc++][CMake] Adds option to disable clang-tidy. (PR #95654)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 15 04:58:53 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

<details>
<summary>Changes</summary>

There have been some reports that always enabling clang-tidy (added in #<!-- -->90077) has some false positives in the detection. It would be good to fix these. This adds an escape hatch to disable the tests, which avoids blocking users with this issue.

---
Full diff: https://github.com/llvm/llvm-project/pull/95654.diff


2 Files Affected:

- (modified) libcxx/CMakeLists.txt (+4) 
- (modified) libcxx/test/tools/CMakeLists.txt (+4) 


``````````diff
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 4b927017f8c2a..9a35ff30114cd 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -60,6 +60,10 @@ option(LIBCXX_ENABLE_FILESYSTEM
    available on the platform. This includes things like most parts of <filesystem> and
    others like <fstream>" ON)
 option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
+option(LIBCXX_DISABLE_CLANG_TIDY_TESTS
+  "Disables test using the clang-tidy plugin. This option should only be used
+   when autodetection fails, please file a bug report so the autodetection can
+   be improved." OFF)
 set(LIBCXX_SUPPORTED_HARDENING_MODES none fast extensive debug)
 set(LIBCXX_HARDENING_MODE "none" CACHE STRING
   "Specify the default hardening mode to use. This mode will be used inside the
diff --git a/libcxx/test/tools/CMakeLists.txt b/libcxx/test/tools/CMakeLists.txt
index 6d99c53ad46d9..801e45521edb8 100644
--- a/libcxx/test/tools/CMakeLists.txt
+++ b/libcxx/test/tools/CMakeLists.txt
@@ -5,4 +5,8 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   message(STATUS "Clang-tidy tests are disabled due to non-clang based compiler.")
   return()
 endif()
+if(LIBCXX_DISABLE_CLANG_TIDY_TESTS)
+  message(STATUS "Clang-tidy tests are disabled by the configuration option LIBCXX_DISABLE_CLANG_TIDY_TESTS.")
+  return()
+endif()
 add_subdirectory(clang_tidy_checks)

``````````

</details>


https://github.com/llvm/llvm-project/pull/95654


More information about the libcxx-commits mailing list