[clang-tools-extra] [clang-tidy] Fix modernize-use-std-format lit test signature (PR #102759)

Mike Crowe via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 10 09:27:46 PDT 2024


https://github.com/mikecrowe created https://github.com/llvm/llvm-project/pull/102759

My fix for my original fix of issue #92896 in
666d224248707f373577b5b049b5b0229100006c modified the function signature for fmt::sprintf to more accurately match the real implementation in libfmt but failed to do the same for absl::StrFormat. The latter fix applied equally well to absl::StrFormat so it's important that its test verifies that the bug is fixed too.

>From c00bc97964b2565f3fa606aa0bb46deb6b5056a2 Mon Sep 17 00:00:00 2001
From: Mike Crowe <mac at mcrowe.com>
Date: Sat, 10 Aug 2024 17:13:04 +0100
Subject: [PATCH] [clang-tidy] Fix modernize-use-std-format lit test signature

My fix for my original fix of issue #92896 in
666d224248707f373577b5b049b5b0229100006c modified the function signature
for fmt::sprintf to more accurately match the real implementation in
libfmt but failed to do the same for absl::StrFormat. The latter fix
applied equally well to absl::StrFormat so it's important that its test
verifies that the bug is fixed too.
---
 .../test/clang-tidy/checkers/modernize/use-std-format.cpp    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
index e8dea1dce2c972..800a95062e8f1a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
@@ -11,9 +11,8 @@
 
 namespace absl
 {
-// Use const char * for the format since the real type is hard to mock up.
-template <typename... Args>
-std::string StrFormat(const char *format, const Args&... args);
+template <typename S, typename... Args>
+std::string StrFormat(const S &format, const Args&... args);
 } // namespace absl
 
 template <typename T>



More information about the cfe-commits mailing list