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

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 07:52:27 PDT 2023


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/PrintfToStdPrintCheck.cpp:66
+  if (Converter.canApply()) {
+    const auto *PrintfCall = Printf->getCallee();
+    DiagnosticBuilder Diag =
----------------
Please don't use `auto` unless type is explicitly stated in same statement or iterator.


================
Comment at: clang-tools-extra/clang-tidy/modernize/PrintfToStdPrintCheck.h:15
+namespace clang::tidy::modernize {
+/// Documentation goes here.
+///
----------------
Should be elaborated or removed.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:171
 
+- New :doc: `modernize-printf-to-std-print
+  <clang-tidy/checks/modernize/printf-to-std-print>` check.
----------------
Please keep alphabetical order (by check name) in this section.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:6
+
+This check is capable of converting calls to printf to calls to std::print
+whilst also modifying the format string appropriately.
----------------
Please make first statement same as in Release Notes. Please highlight language constructs (like `printf`) with double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:11
+
+ fprintf(stderr, "The %s is %3d\n", answer, value);
+
----------------
Please prepend with `.. code-block:: c++` line. Same for other snippets.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:73
+   printf-style format string and the arguments to be formatted follow
+   immediately afterwards.
+
----------------
Please add information about default value.


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