This check flags code which uses _LIBCPP_STD_VER the wrong way, or tries to use __cplusplus. It flags cases where we use _LIBCPP_STD_VER > instead of _LIBCPP_STD_VER >= and where wrong values are used (e.g. _LIBCPP_STD_VER >= 24).
Details
- Reviewers
ldionne Mordante - Group Reviewers
Restricted Project - Commits
- rG07efa28314ce: [libc++] Add clang-tidy check for version checks
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Are we running clang-tidy only on our headers or also on our test suite?
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | ||
---|---|---|
6–15 | This should be 16 for the CI. IIRC 17 is not installed by the CI. |
Only in our headers currently, not even in src/.
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | ||
---|---|---|
6–15 | This diff shouldn't be here. The problem is that find_package(Clang 16...17) isn't "use Clang version 16 or 17", like one would expect. I'm not sure what it actually is, but AFAICT we have to use find_package(Clang 16) if (NOT Clang_FOUND) find_package(Clang 17) endif() to fix this. |
LGTM, but I like to see the CI green before approving.
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt | ||
---|---|---|
6–15 | I have a fix for running CMake twice and can address this issue in the same patch, so let's revert this hunk in this patch. |
LGTM w/ green CI. Please also provide a short description of the check being added in the commit message. Add clang-tidy check for version checks is not self-explanatory.
This should be 16 for the CI. IIRC 17 is not installed by the CI.
I ran issues with this while testing locally with Clang-tidy, I am looking at the issue where cmake fails to run a second time and I have a solution, but I want to test a bit further before making a patch.