[libc++] Add clang-tidy check for version checks
authorNikolas Klauser <nikolasklauser@berlin.de>
Fri, 17 Feb 2023 13:01:19 +0000 (14:01 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Wed, 8 Mar 2023 14:17:25 +0000 (15:17 +0100)
commit07efa28314ce968dadadbcaff95cde2b9424a5ed
tree08f7d9a5eb35343291285026ec2074bcd4016e7a
parent6f216f0539981de5c6ee69597cb3fad9ac046418
[libc++] Add clang-tidy check for version checks

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`).

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D144261
libcxx/include/__chrono/concepts.h
libcxx/include/__config
libcxx/include/iomanip
libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp [new file with mode: 0644]
libcxx/test/tools/clang_tidy_checks/proper_version_checks.hpp [new file with mode: 0644]