This is an automated email from the ASF dual-hosted git repository.
cyx-6 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new a8e370c4 [LINT] Keep C++20 syntax rewrites optional in clang-tidy
(#924)
a8e370c4 is described below
commit a8e370c4818fda2b5f666a879253b55d54c9fe33
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Nov 4 14:22:12 2026 -0500
[LINT] Keep C++20 syntax rewrites optional in clang-tidy (#924)
After #920 moved TVM FFI to C++20, clang-tidy enables several modernize
checks that only apply to C++20, and the mainline clang-tidy job over
`src/`, `include/`, and `tests/` now fails on existing code: designated
initializers for `DLDataType`/`DLDevice`, `std::ranges` algorithms,
`starts_with`/`ends_with`, `std::numbers`, and reverse range-based
loops.
Following #920, which kept the C++20 constraint and integer-comparison
rewrites optional, this PR disables
`modernize-use-designated-initializers`, `modernize-use-ranges`,
`modernize-use-starts-ends-with`, and `modernize-use-std-numbers`, and
sets `modernize-loop-convert.UseCxx20ReverseRanges` to `false` so loop
conversion keeps its pre-C++20 behavior.
---
.clang-tidy | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/.clang-tidy b/.clang-tidy
index bebf3af0..99493e64 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,5 +1,6 @@
# -clang-analyzer-unix.Malloc is disabled due to false positives
-# C++20 constraints and integer comparison rewrites remain optional.
+# C++20 syntax rewrites (constraints, integer comparisons, designated
+# initializers, ranges, starts_with/ends_with, std::numbers) remain optional.
Checks: >
clang-diagnostic-*,
clang-analyzer-*,
@@ -14,6 +15,10 @@ Checks: >
-modernize-use-nodiscard,
-modernize-use-constraints,
-modernize-use-integer-sign-comparison,
+ -modernize-use-designated-initializers,
+ -modernize-use-ranges,
+ -modernize-use-starts-ends-with,
+ -modernize-use-std-numbers,
-modernize-return-braced-init-list,
-modernize-avoid-c-arrays,
-bugprone-easily-swappable-parameters,
@@ -26,6 +31,8 @@ HeaderFilterRegex: '.*(include/tvm/ffi|src/ffi)/.*\.h$'
HeaderFileExtensions: ['h']
ImplementationFileExtensions: ['cc']
CheckOptions:
+ - key: modernize-loop-convert.UseCxx20ReverseRanges
+ value: 'false'
- key: misc-include-cleaner.UnusedIncludes
value: 'true'
- key: misc-include-cleaner.MissingIncludes