[libcxx-commits] [libcxx] cf64668 - [libc++][test] Prefers the newer clang-tidy version.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 31 08:24:45 PDT 2023


Author: Mark de Wever
Date: 2023-05-31T17:24:37+02:00
New Revision: cf64668b8c414c60aec12cdd7374ea053fc99411

URL: https://github.com/llvm/llvm-project/commit/cf64668b8c414c60aec12cdd7374ea053fc99411
DIFF: https://github.com/llvm/llvm-project/commit/cf64668b8c414c60aec12cdd7374ea053fc99411.diff

LOG: [libc++][test] Prefers the newer clang-tidy version.

Module require Clang 17, since Clang 16 requires the magic # __FILE__
line. Therefore, if available, use clang-tidy 17 too. This change should
be reverted after LLVM 17 is released.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D149455

Added: 
    

Modified: 
    libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
    libcxx/utils/libcxx/test/features.py

Removed: 
    


################################################################################
diff  --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
index bd1611fb0a9cc..1a9f921a5c38e 100644
--- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -1,17 +1,17 @@
 
-# Look for the latest package
-set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
-set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
-
 # The find_package changes these variables. This leaves the build in an odd
 # state. Calling cmake a second time tries to write site config information in
 # the system's libc++. Restoring these setting after testing fixes this issue.
 set(LLVM_DIR_SAVE ${LLVM_DIR})
 set(Clang_DIR_SAVE ${Clang_DIR})
 
-find_package(Clang 16)
+# TODO LLVM 17 prefer to use teh stable release again instead of ToT.
+# libc++ normally prefers the use the last stable release instead of the ToT.
+# For modules we need ToT since they are still under heavy development. So
+# temporary the ToT version is preferred.
+find_package(Clang 17)
 if (NOT Clang_FOUND)
-  find_package(Clang 17)
+  find_package(Clang 16)
 endif()
 
 set(SOURCES

diff  --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index b4478b55cb29b..fc1680c049947 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -38,6 +38,10 @@ def _getSuitableClangTidy(cfg):
         ):
             return None
 
+        # TODO MODULES require ToT due module specific fixes.
+        if runScriptExitCode(cfg, ['clang-tidy-17 --version']) == 0:
+          return 'clang-tidy-17'
+
         # TODO This should be the last stable release.
         # LLVM RELEASE bump to latest stable version
         if runScriptExitCode(cfg, ["clang-tidy-16 --version"]) == 0:


        


More information about the libcxx-commits mailing list