I have been working on migrating a codebase to C++20 and came across several instances of x >= std::numeric_limits<T>::min() && x <= std::numeric_limits<T>::max(). Clang-tidy already has a check that can migrate signed/unsigned comparisons to std::cmp_* functions. I think it makes sense to have the std::in_range migration a part of those checks or a new check.
Posting here to check if there’s any interest in having such a checker. If yes, I have an implementation (implemented partially by Claude) that I can clean up and push as a PR in accordance with the AI usage policy.
Post on LLVM Discourse: https://discourse.llvm.org/t/rfc-clang-tidy-check-to-suggest-std-in-range-in-place-of-x-min-x-max/90460
I have been working on migrating a codebase to C++20 and came across several instances of
x >= std::numeric_limits<T>::min() && x <= std::numeric_limits<T>::max(). Clang-tidy already has a check that can migrate signed/unsigned comparisons tostd::cmp_*functions. I think it makes sense to have thestd::in_rangemigration a part of those checks or a new check.Posting here to check if there’s any interest in having such a checker. If yes, I have an implementation (implemented partially by Claude) that I can clean up and push as a PR in accordance with the AI usage policy.
Post on LLVM Discourse: https://discourse.llvm.org/t/rfc-clang-tidy-check-to-suggest-std-in-range-in-place-of-x-min-x-max/90460