[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 24 09:02:25 PDT 2023


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:29
+- It assumes that the format string is correct for the arguments. If you
+  get any warnings when compiling with ``-Wformat`` then misbehaviour is
+  possible.
----------------
Please use single back-ticks for `-Wformat` (command-line option).


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:81
+
+   When true, the check will add casts when converting from variadic
+   functions like ``printf`` and printing signed or unsigned integer types
----------------
Please highlight `true` with back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:87
+   converting from non-variadic functions such as ``absl::PrintF`` and
+   ``fmt::printf``. For example, with ``StrictMode`` enabled:
+
----------------
Please use single back-ticks for `StrictMode` (option).


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:103
+  of -42 and the signed representation of 0xffffffff (often 4294967254
+  and -1 respectively.) When false (which is the default), these casts
+  will not be added which may cause a change in the output.
----------------
Please highlight `false` and numbers with back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:112
+   immediately afterwards. If neither this option nor
+   ``FprintfLikeFunctions`` are set then the default value for this option
+   is ``printf; absl::PrintF``, otherwise it is empty.
----------------
Please use single back-ticks for `FprintfLikeFunctions` (option). Same for `printf; absl::PrintF` below.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:122
+   arguments to be formatted follow immediately afterwards. If neither this
+   option nor ``PrintfLikeFunctions`` are set then the default value for
+   this option is ``fprintf; absl::FPrintF``, otherwise it is empty.
----------------
Ditto.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:144
+   The header that must be included for the declaration of
+   ``ReplacementPrintFunction`` so that a ``#include`` directive can be
+   added if required. If ``ReplacementPrintFunction`` is ``std::print``
----------------
Please use single back-ticks for `ReplacementPrintFunction` (option).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149280/new/

https://reviews.llvm.org/D149280



More information about the cfe-commits mailing list