[clang-tools-extra] [clang-tidy][NFC] Clarify some options use regex to matching in doc (1/N) (PR #161142)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 29 17:57:59 PDT 2025


https://github.com/flovent updated https://github.com/llvm/llvm-project/pull/161142

>From 9edb30955713426f1eb94d466a1d010176c1ddfc Mon Sep 17 00:00:00 2001
From: flovent <flbven at protonmail.com>
Date: Mon, 29 Sep 2025 15:52:04 +0800
Subject: [PATCH 1/4] [clang-tidy][NFC] Clarify some options use regex to
 matching in doc (1/N)

---
 ...ounds-avoid-unchecked-container-access.rst |  4 +--
 .../checks/modernize/use-std-format.rst       | 12 +++----
 .../checks/modernize/use-std-print.rst        | 32 ++++++++++---------
 .../readability/container-size-empty.rst      | 10 +++---
 .../readability/redundant-string-cstr.rst     | 14 ++++----
 5 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
index 556d90213b216..b64158ded6100 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
@@ -39,8 +39,8 @@ Options
 
 .. option:: ExcludeClasses
 
-    Semicolon-delimited list of class names for overwriting the default
-    exclusion list. The default is:
+    Semicolon-delimited list of regular expressions matching class names that
+    overwriting the default exclusion list. The default is:
     `::std::map;::std::unordered_map;::std::flat_map`.
     
 .. option:: FixMode
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
index cfa11d3cac8bf..fb46d73071a53 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
@@ -62,12 +62,12 @@ Options
 
 .. option:: StrFormatLikeFunctions
 
-   A semicolon-separated list of (fully qualified) function names to
-   replace, with the requirement that the first parameter contains the
-   printf-style format string and the arguments to be formatted follow
-   immediately afterwards. Qualified member function names are supported,
-   but the replacement function name must be unqualified. The default value
-   for this option is `absl::StrFormat`.
+   A semicolon-separated list of regular expressions matching the 
+   (fully qualified) names of functions to replace, with the requirement that
+   the first parameter contains the printf-style format string and the
+   arguments to be formatted follow immediately afterwards. Qualified member
+   function names are supported, but the replacement function name must be
+   unqualified. The default value for this option is `absl::StrFormat`.
 
 .. option:: ReplacementFormatFunction
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
index 0cf51e3961a05..9d09b1ee718b7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
@@ -122,25 +122,27 @@ Options
 
 .. option:: PrintfLikeFunctions
 
-   A semicolon-separated list of (fully qualified) function names to
-   replace, with the requirement that the first parameter contains the
-   printf-style format string and the arguments to be formatted follow
-   immediately afterwards. Qualified member function names are supported,
-   but the replacement function name must be unqualified. If neither this
-   option nor `FprintfLikeFunctions` are set then the default value for
-   this option is `printf; absl::PrintF`, otherwise it is empty.
+   A semicolon-separated list of regular expressions matching the 
+   (fully qualified) names of functions to replace, with the requirement
+   that the first parameter contains the printf-style format string and the
+   arguments to be formatted follow immediately afterwards. Qualified member
+   function names are supported, but the replacement function name must be
+   unqualified. If neither this option nor `FprintfLikeFunctions` are set then
+   the default value for this option is `printf; absl::PrintF`, otherwise it is
+   empty.
 
 
 .. option:: FprintfLikeFunctions
 
-   A semicolon-separated list of (fully qualified) function names to
-   replace, with the requirement that the first parameter is retained, the
-   second parameter contains the printf-style format string and the
-   arguments to be formatted follow immediately afterwards. Qualified
-   member function names are supported, but the replacement function name
-   must be unqualified. If neither this option nor `PrintfLikeFunctions`
-   are set then the default value for this option is `fprintf;
-   absl::FPrintF`, otherwise it is empty.
+   A semicolon-separated list of regular expressions matching the 
+   (fully qualified) names of functions to replace, with the requirement
+   that the first parameter is retained, the second parameter contains the
+   printf-style format string and the arguments to be formatted follow
+   immediately afterwards. Qualified member function names are supported,
+   but the replacement function name must be unqualified. If neither this
+   option nor `PrintfLikeFunctions` are set then the default value for this
+   option is `fprintf;absl::FPrintF`, otherwise it is empty.
+
 
 .. option:: ReplacementPrintFunction
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
index da6f770b3d74b..211f19203d814 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
@@ -30,8 +30,8 @@ Options
 
 .. option:: ExcludedComparisonTypes
 
-    A semicolon-separated list of class names for which the check will ignore
-    comparisons of objects with default-constructed objects of the same type.
-    If a class is listed here, the check will not suggest using ``empty()``
-    instead of such comparisons for objects of that class.
-    Default value is: `::std::array`.
+    A semicolon-separated list of regular expressions matching class names that
+    the check will ignore comparisons of objects with default-constructed
+    objects of the same type. If a class is listed here, the check will not
+    suggest using ``empty()`` instead of such comparisons for objects of that
+    class. Default value is: `::std::array`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-string-cstr.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-string-cstr.rst
index 2789f9c096ccf..7b507771d6799 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-string-cstr.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-string-cstr.rst
@@ -11,10 +11,10 @@ Options
 
 .. option:: StringParameterFunctions
 
-   A semicolon-separated list of (fully qualified) function/method/operator
-   names, with the requirement that any parameter currently accepting a
-   ``const char*`` input should also be able to accept ``std::string``
-   inputs, or proper overload candidates that can do so should exist. This
-   can be used to configure functions such as ``fmt::format``,
-   ``spdlog::logger::info``, or wrappers around these and similar
-   functions. The default value is the empty string.
+   A semicolon-separated list of regular expressions matching the
+   (fully qualified) names of function/method/operator, with the requirement
+   that any parameter currently accepting a ``const char*`` input should also
+   be able to accept ``std::string`` inputs, or proper overload candidates that
+   can do so should exist. This can be used to configure functions such as
+   ``fmt::format``, ``spdlog::logger::info``, or wrappers around these and
+   similar functions. The default value is the empty string.

>From dd509406d7a3819a6c3fd45a4ef1ba01ceb57493 Mon Sep 17 00:00:00 2001
From: flovent <flbven at protonmail.com>
Date: Mon, 29 Sep 2025 21:48:24 +0800
Subject: [PATCH 2/4] Apply suggestions from code review

Co-authored-by: EugeneZelenko <eugene.zelenko at gmail.com>
---
 .../docs/clang-tidy/checks/modernize/use-std-format.rst    | 2 +-
 .../docs/clang-tidy/checks/modernize/use-std-print.rst     | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
index fb46d73071a53..7038e7bfc5d26 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-format.rst
@@ -67,7 +67,7 @@ Options
    the first parameter contains the printf-style format string and the
    arguments to be formatted follow immediately afterwards. Qualified member
    function names are supported, but the replacement function name must be
-   unqualified. The default value for this option is `absl::StrFormat`.
+   unqualified. The default value is `absl::StrFormat`.
 
 .. option:: ReplacementFormatFunction
 
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
index 9d09b1ee718b7..ca0d42c710d8d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
@@ -128,8 +128,7 @@ Options
    arguments to be formatted follow immediately afterwards. Qualified member
    function names are supported, but the replacement function name must be
    unqualified. If neither this option nor `FprintfLikeFunctions` are set then
-   the default value for this option is `printf; absl::PrintF`, otherwise it is
-   empty.
+   the default value is `printf; absl::PrintF`, otherwise it is empty string.
 
 
 .. option:: FprintfLikeFunctions
@@ -140,8 +139,8 @@ Options
    printf-style format string and the arguments to be formatted follow
    immediately afterwards. Qualified member function names are supported,
    but the replacement function name must be unqualified. If neither this
-   option nor `PrintfLikeFunctions` are set then the default value for this
-   option is `fprintf;absl::FPrintF`, otherwise it is empty.
+   option nor `PrintfLikeFunctions` are set then the default value is 
+   `fprintf;absl::FPrintF`, otherwise it is empty string.
 
 
 .. option:: ReplacementPrintFunction

>From abdbe576f682f02193e11861235cb8c7da83b0cc Mon Sep 17 00:00:00 2001
From: flovent <flbven at protonmail.com>
Date: Tue, 30 Sep 2025 08:55:17 +0800
Subject: [PATCH 3/4] Apply suggestions from code review

Co-authored-by: Victor Chernyakin <chernyakin.victor.j at outlook.com>
---
 .../pro-bounds-avoid-unchecked-container-access.rst           | 4 ++--
 .../docs/clang-tidy/checks/modernize/use-std-print.rst        | 4 ++--
 .../clang-tidy/checks/readability/container-size-empty.rst    | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
index b64158ded6100..1ecdcdb1ed4c7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.rst
@@ -39,8 +39,8 @@ Options
 
 .. option:: ExcludeClasses
 
-    Semicolon-delimited list of regular expressions matching class names that
-    overwriting the default exclusion list. The default is:
+    Semicolon-separated list of regular expressions matching class names that
+    overwrites the default exclusion list. The default is:
     `::std::map;::std::unordered_map;::std::flat_map`.
     
 .. option:: FixMode
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
index ca0d42c710d8d..08f1be3eee63f 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
@@ -128,7 +128,7 @@ Options
    arguments to be formatted follow immediately afterwards. Qualified member
    function names are supported, but the replacement function name must be
    unqualified. If neither this option nor `FprintfLikeFunctions` are set then
-   the default value is `printf; absl::PrintF`, otherwise it is empty string.
+   the default value is `printf; absl::PrintF`, otherwise it is the empty string.
 
 
 .. option:: FprintfLikeFunctions
@@ -140,7 +140,7 @@ Options
    immediately afterwards. Qualified member function names are supported,
    but the replacement function name must be unqualified. If neither this
    option nor `PrintfLikeFunctions` are set then the default value is 
-   `fprintf;absl::FPrintF`, otherwise it is empty string.
+   `fprintf;absl::FPrintF`, otherwise it is the empty string.
 
 
 .. option:: ReplacementPrintFunction
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
index 211f19203d814..cc012fdcd7649 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
@@ -30,8 +30,8 @@ Options
 
 .. option:: ExcludedComparisonTypes
 
-    A semicolon-separated list of regular expressions matching class names that
-    the check will ignore comparisons of objects with default-constructed
+    A semicolon-separated list of regular expressions matching class names for
+    which the check will ignore comparisons of objects with default-constructed
     objects of the same type. If a class is listed here, the check will not
     suggest using ``empty()`` instead of such comparisons for objects of that
     class. Default value is: `::std::array`.

>From b5145863909f5d8a0c72d488bed2d2de72b7063c Mon Sep 17 00:00:00 2001
From: flovent <flbven at protonmail.com>
Date: Tue, 30 Sep 2025 08:57:45 +0800
Subject: [PATCH 4/4] 80 characters limit

---
 .../docs/clang-tidy/checks/modernize/use-std-print.rst         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
index 08f1be3eee63f..eb2159bc848d1 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
@@ -128,7 +128,8 @@ Options
    arguments to be formatted follow immediately afterwards. Qualified member
    function names are supported, but the replacement function name must be
    unqualified. If neither this option nor `FprintfLikeFunctions` are set then
-   the default value is `printf; absl::PrintF`, otherwise it is the empty string.
+   the default value is `printf; absl::PrintF`, otherwise it is the empty
+   string.
 
 
 .. option:: FprintfLikeFunctions



More information about the cfe-commits mailing list