[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

Mike Crowe via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 08:38:27 PDT 2024


================
@@ -0,0 +1,84 @@
+.. title:: clang-tidy - modernize-use-std-format
+
+modernize-use-std-format
+========================
+
+Converts calls to ``absl::StrFormat``, or other functions via
+configuration options, to C++20's ``std::format``, or another function
+via a configuration option, modifying the format string appropriately and
+removing now-unnecessary calls to ``std::string::c_str()`` and
+``std::string::data()``.
+
+For example, it turns lines like
+
+.. code-block:: c++
+
+  return absl::StrFormat("The %s is %3d\n", description.c_str(), value);
----------------
mikecrowe wrote:

The newline in the format string here should be removed since it isn't present in the format string on line 22 below.

https://github.com/llvm/llvm-project/pull/90397


More information about the cfe-commits mailing list