[libcxx-commits] [libcxx] 30033bd - [libc++][CI] Improves clang-(tidy|query) selection.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 28 11:01:11 PST 2022
Author: Mark de Wever
Date: 2022-12-28T20:01:06+01:00
New Revision: 30033bdaf3f4a8cf6dd329ce8bc8a20511452c9a
URL: https://github.com/llvm/llvm-project/commit/30033bdaf3f4a8cf6dd329ce8bc8a20511452c9a
DIFF: https://github.com/llvm/llvm-project/commit/30033bdaf3f4a8cf6dd329ce8bc8a20511452c9a.diff
LOG: [libc++][CI] Improves clang-(tidy|query) selection.
Hardcode the version of the tools used in the test feature script
instead of the tests. By changing the hard-coded location it's
easier to make the location flexible in the future.
Drive-by change
- The minimum required version for clang-query is now 15, which matches
our future idea as outlined in the Dockerfile.
- The minimum required version for clang-tidy is now 16, which enables
the new clang-tidy ADL plugin. This plugin is disabled for C++03
due to false positives when using `noexcept`, which is not an operator
in C++03.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D139545
Added:
Modified:
libcxx/test/libcxx/clang_query.sh.cpp
libcxx/test/libcxx/clang_tidy.sh.cpp
libcxx/utils/ci/run-buildbot
libcxx/utils/libcxx/test/features.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/clang_query.sh.cpp b/libcxx/test/libcxx/clang_query.sh.cpp
index 1364ff8327157..704445960f2c9 100644
--- a/libcxx/test/libcxx/clang_query.sh.cpp
+++ b/libcxx/test/libcxx/clang_query.sh.cpp
@@ -13,7 +13,7 @@
// The attributes hide_from_abi_of_visible.query relies on aren't applied on windows.
// XFAIL: windows
-// RUN: clang-query -f %S/clang_query/hide_from_abi_or_visible.query %s --use-color -- -Wno-unknown-warning-option %{compile_flags} -fno-modules > %t.output
+// RUN: %{clang-query} -f %S/clang_query/hide_from_abi_or_visible.query %s --use-color -- -Wno-unknown-warning-option %{compile_flags} -fno-modules > %t.output
// RUN: cat %t.output
// RUN: cat %t.output | wc -l | grep -Fxq 1
diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp
index 70a9026eafb81..7e4b88b91114b 100644
--- a/libcxx/test/libcxx/clang_tidy.sh.cpp
+++ b/libcxx/test/libcxx/clang_tidy.sh.cpp
@@ -12,8 +12,8 @@
// UNSUPPORTED: gcc
// TODO: run clang-tidy with modules enabled once they are supported
-// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin -- %{compile_flags} -fno-modules
-// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* --config-file=%S/../../.clang-tidy -- -Wweak-vtables %{compile_flags} -fno-modules
+// RUN: %{clang-tidy} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{test-tools}/clang_tidy_checks/libcxx-tidy.plugin -- %{compile_flags} -fno-modules
+// RUN: %{clang-tidy} %s --warnings-as-errors=* -header-filter=.* --config-file=%S/../../.clang-tidy -- -Wweak-vtables %{compile_flags} -fno-modules
// Prevent <ext/hash_map> from generating deprecated warnings for this test.
#if defined(__DEPRECATED)
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 3ee025c19e06b..e17eaf18d50ad 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -226,8 +226,9 @@ check-generated-output)
#
generic-cxx03)
clean
- generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" \
- -DLIBCXX_ENABLE_CLANG_TIDY=ON
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
+ #generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" \
+ # -DLIBCXX_ENABLE_CLANG_TIDY=ON
check-runtimes
check-abi-list
;;
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index f122c75aa6799..094608c2a16ee 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -18,19 +18,6 @@
_isMSVC = lambda cfg: '_MSC_VER' in compilerMacros(cfg)
_msvcVersion = lambda cfg: (int(compilerMacros(cfg)['_MSC_VER']) // 100, int(compilerMacros(cfg)['_MSC_VER']) % 100)
-def _hasSuitableClangTidy(cfg):
- try:
- return int(re.search('[0-9]+', commandOutput(cfg, ['clang-tidy --version'])).group()) >= 13 and runScriptExitCode(
- cfg, ['stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin']) == 0
- except ConfigurationRuntimeError:
- return False
-
-def _hasSuitableClangQuery(cfg):
- try:
- return int(re.search('[0-9]+', commandOutput(cfg, ['clang-query --version'])).group()) >= 13
- except ConfigurationRuntimeError:
- return False
-
DEFAULT_FEATURES = [
Feature(name='fcoroutines-ts',
when=lambda cfg: hasCompileFlag(cfg, '-fcoroutines-ts') and
@@ -154,9 +141,13 @@ def _hasSuitableClangQuery(cfg):
Feature(name='executor-has-no-bash',
when=lambda cfg: runScriptExitCode(cfg, ['%{exec} bash -c \'bash --version\'']) != 0),
Feature(name='has-clang-tidy',
- when=_hasSuitableClangTidy),
+ # TODO This should be the last stable release.
+ when=lambda cfg: runScriptExitCode(cfg, ['clang-tidy-16 --version']) == 0 and
+ runScriptExitCode(cfg, ['stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin']) == 0,
+ actions=[AddSubstitution('%{clang-tidy}', 'clang-tidy-16')]),
Feature(name='has-clang-query',
- when=_hasSuitableClangQuery),
+ when=lambda cfg: runScriptExitCode(cfg, ['clang-query-15 --version']) == 0,
+ actions=[AddSubstitution('%{clang-query}', 'clang-query-15')]),
Feature(name='apple-clang', when=_isAppleClang),
Feature(name=lambda cfg: 'apple-clang-{__clang_major__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
More information about the libcxx-commits
mailing list