https://github.com/MainakSil updated https://github.com/llvm/llvm-project/pull/108805
>From 20b262e9954ec1505b1be4ea3cc362b2a9955bb9 Mon Sep 17 00:00:00 2001 From: Mainak Sil <mainaks...@gmail.com> Date: Sun, 15 Sep 2024 22:03:43 +0530 Subject: [PATCH 1/3] [docs][clang-tidy] Correct StrictMode example in modernize-use-std-print --- .../docs/clang-tidy/checks/modernize/use-std-print.rst | 2 +- 1 file changed, 1 insertion(+), 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 59bb722e2c24fc..a825cd7432a57d 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 @@ -109,7 +109,7 @@ Options .. code-block:: c++ - std::print("{} {}\n", static_cast<unsigned int>(i), static_cast<int>(u)); + std::print("{} {}\n", static_cast<int>(u), static_cast<unsigned int>(i)); to ensure that the output will continue to be the unsigned representation of `-42` and the signed representation of `0xffffffff` (often >From e64700266ecc08b23f88415036c45177a03c40c2 Mon Sep 17 00:00:00 2001 From: Mainak Sil <mainaks...@gmail.com> Date: Mon, 16 Sep 2024 14:41:49 +0530 Subject: [PATCH 2/3] [docs][clang-tidy] Correct StrictMode example in modernize-use-std-print Updated the example in the StrictMode section of the clang-tidy check modernize-use-std-print. The previous example incorrectly swapped the cast of signed and unsigned integers. Specifically: The signed integer i was being cast to unsigned int, and The unsigned integer u was being cast to int. This correction ensures that the behavior of std::print with StrictMode enabled matches that of printf, by reversing the casts to maintain the correct signedness. Issue Refference It solves #llvm#101397 >From 000fa0b26c087c17b23da57d02422816c00bcbd1 Mon Sep 17 00:00:00 2001 From: Mainak Sil <mainaks...@gmail.com> Date: Mon, 16 Sep 2024 22:31:55 +0530 Subject: [PATCH 3/3] Update use-std-print.rst --- .../docs/clang-tidy/checks/modernize/use-std-print.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 a825cd7432a57d..e70402ad8b3341 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 @@ -103,13 +103,13 @@ Options int i = -42; unsigned int u = 0xffffffff; - printf("%d %u\n", i, u); + printf("%u %d\n", i, u); would be converted to: .. code-block:: c++ - std::print("{} {}\n", static_cast<int>(u), static_cast<unsigned int>(i)); + std::print("{} {}\n", static_cast<unsigned int>(i), static_cast<int>(u)); to ensure that the output will continue to be the unsigned representation of `-42` and the signed representation of `0xffffffff` (often _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits