https://github.com/zeyi2 updated https://github.com/llvm/llvm-project/pull/184769
>From 1e0a7f1a42b33810013cda2e59f5edebb5576e25 Mon Sep 17 00:00:00 2001 From: mtx <[email protected]> Date: Thu, 5 Mar 2026 18:55:55 +0800 Subject: [PATCH] [clang-tidy][NFC] Update contribution guide for test language standards --- .../docs/clang-tidy/Contributing.rst | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst b/clang-tools-extra/docs/clang-tidy/Contributing.rst index 72444480ece0e..d0cc43f9bbad9 100644 --- a/clang-tools-extra/docs/clang-tidy/Contributing.rst +++ b/clang-tools-extra/docs/clang-tidy/Contributing.rst @@ -662,6 +662,28 @@ Here's an example: // CHECK-FIXES-USING-B-NOT: using a::B;$ // CHECK-FIXES-NOT: using a::C;$ +Specifying the Language Standard +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``-std`` flag controls which C or C++ standard(s) the test is compiled +under. It accepts a comma-separated list of standards and supports an +``-or-later`` suffix: + +- ``-std=c++17``: runs the test **only** with C++17. +- ``-std=c++17-or-later``: runs the test once for each standard from C++17 + onwards (currently C++17, C++20, C++23, and C++26), in separate invocations. + Use this when a check should work correctly on all modern standards. +- ``-std=c++14,c++17``: runs the test once with C++14 and once with C++17. + +When no ``-std`` is given, ``check_clang_tidy.py`` defaults to +``c++11-or-later`` for C++ files and ``c99-or-later`` for C files. The check +skeleton generated by ``add_new_check.py`` uses the ``-or-later`` form by +default. Prefer ``-std=<minimum>-or-later`` unless the test expects +behavior that only applies to a specific standard version. + +Common Pitfalls and Edge Cases +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + There are many dark corners in the C++ language, and it may be difficult to make your check work perfectly in all cases, especially if it issues fix-it hints. The most frequent pitfalls are macros and templates: _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
