kadircet wrote:
hi! this seems to be crashing for certain code patterns,
https://github.com/llvm/llvm-project/issues/92896 has a minimal reproducer
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/PiotrZSL closed
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
mikecrowe wrote:
@PiotrZSL wrote:
> Once build will pass, I will land this change, and fixes could be done in
> separate PR for both checks.
The build seems to be passing. Please can you land this if you are happy?
Thanks.
https://github.com/llvm/llvm-project/pull/90397
__
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -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 op
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 01/16] [clang-tidy] Add modernize-use-std-format check
Add a new c
mikecrowe wrote:
Thanks! I wasn't aware that was possible since I started with all these checks
before fbf611ed2a768999202e2c5e1e1a6c3c6bb94725 and had been battling with the
JSON syntax.
https://github.com/llvm/llvm-project/pull/90397
___
https://github.com/mikecrowe edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -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 op
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/5chmidti edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/5chmidti approved this pull request.
Just nits, otherwise LGTM!
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -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 op
5chmidti wrote:
Should the check options use the simpler format? E.g.
```
CheckOptions:
modernize-use-std-format.StrFormatLikeFunctions:
'unqualified_strprintf;::strprintf; mynamespace::strprintf2'
```
https://github.com/llvm/llvm-project/pull/90397
__
https://github.com/5chmidti edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderni
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 01/12] [clang-tidy] Add modernize-use-std-format check
Add a new c
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderni
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderni
@@ -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 op
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderni
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderni
https://github.com/PiotrZSL approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderniz
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mikecrowe edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mikecrowe edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mikecrowe edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderniz
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 01/11] [clang-tidy] Add modernize-use-std-format check
Add a new c
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 01/10] [clang-tidy] Add modernize-use-std-format check
Add a new c
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 1/9] [clang-tidy] Add modernize-use-std-format check
Add a new cla
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/mikecrowe edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -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 op
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -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 op
@@ -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 op
@@ -0,0 +1,107 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/SimplyDanny edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/SimplyDanny approved this pull request.
Only a few nits concerning non-functional code/text. Other than that LGTM.
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
@@ -0,0 +1,108 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderniz
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 1/8] [clang-tidy] Add modernize-use-std-format check
Add a new cla
@@ -0,0 +1,97 @@
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s modernize-use-std-format %t -- \
+// RUN: -config="{CheckOptions: [{key: StrictMode, value: true}]}" \
+// RUN: -- -isystem %clang_tidy_headers
+// RUN: %check_clang_tidy \
+// RUN: -std=c++20 %s moderniz
@@ -0,0 +1,48 @@
+//===--- UseStdFormatCheck.h - clang-tidy ---*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
@@ -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 op
@@ -627,7 +628,8 @@ void FormatStringConverter::finalizeFormatText() {
// It's clearer to convert printf("Hello\r\n"); to std::print("Hello\r\n")
// than to std::println("Hello\r");
- if (StringRef(StandardFormatString).ends_with("\\n") &&
+ if (Config.AllowTrailingNewli
@@ -0,0 +1,108 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/PiotrZSL edited
https://github.com/llvm/llvm-project/pull/90397
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/PiotrZSL approved this pull request.
To be honest I'm not sure why it wasn't merged, there were some dependences on
other changes and modernize-use-std-print check, and somehow it fall under
radar.
Overall looks fine. Please fix pointed out nits that pop up.
https://github.
@@ -0,0 +1,108 @@
+//===--- UseStdFormatCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
https://github.com/mikecrowe updated
https://github.com/llvm/llvm-project/pull/90397
>From 0d6ede5d59cc70d803bfe2c7997737c1be358c75 Mon Sep 17 00:00:00 2001
From: Mike Crowe
Date: Sun, 28 Apr 2024 12:41:46 +0100
Subject: [PATCH 1/2] [clang-tidy] Add modernize-use-std-format check
Add a new cla
@@ -0,0 +1,50 @@
+//===--- UseStdFormatCheck.h - clang-tidy ---*- C++
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apa
llvmbot wrote:
@llvm/pr-subscribers-clang-tools-extra
Author: Mike Crowe (mikecrowe)
Changes
Add a new clang-tidy check that converts absl::StrFormat (and similar
functions) to std::format (and similar functions.)
Split the configuration of FormatStringConverter out to a separate
Config
llvmbot wrote:
@llvm/pr-subscribers-clang-tidy
Author: Mike Crowe (mikecrowe)
Changes
Add a new clang-tidy check that converts absl::StrFormat (and similar
functions) to std::format (and similar functions.)
Split the configuration of FormatStringConverter out to a separate
Configuration
mikecrowe wrote:
This check was originally proposed and reviewed at
https://reviews.llvm.org/D154287 last year but never landed since I did not
(and still do not) have commit access. Near the end of that review, @PiotrZSL
wrote:
> To be honest, I do not see to much use case for this check. But
https://github.com/mikecrowe created
https://github.com/llvm/llvm-project/pull/90397
Add a new clang-tidy check that converts absl::StrFormat (and similar
functions) to std::format (and similar functions.)
Split the configuration of FormatStringConverter out to a separate
Configuration class
63 matches
Mail list logo