Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5 |
|
#
a4f835c5 |
| 21-Nov-2024 |
Zahira Ammarguellat <zahira.ammarguellat@intel.com> |
[clang-tidy][NFC] Fix uninitialized pointer field. (#117173)
Non-static class member `PP` is not initialized in this constructor nor
in any functions that it calls.
|
Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2 |
|
#
a199fb12 |
| 08-Oct-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Only expand <inttypes.h> macros in modernize-use-std-format/print (#97911)
Expanding all macros in the printf/absl::StrFormat format string before
conversion could easily break code if
[clang-tidy] Only expand <inttypes.h> macros in modernize-use-std-format/print (#97911)
Expanding all macros in the printf/absl::StrFormat format string before
conversion could easily break code if those macros are expanded change
their definition between builds. It's important for this check to expand
the <inttypes.h> PRI macros though, so let's ensure that the presence of
any other macros in the format string causes the check to emit a warning
and not perform any conversion.
show more ...
|
Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3 |
|
#
bbcb6257 |
| 18-Aug-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Support member functions with modernize-use-std-print/format (#104675)
These checks can be made to work on member functions quite easily and
it's not unknown to have at least printf-st
[clang-tidy] Support member functions with modernize-use-std-print/format (#104675)
These checks can be made to work on member functions quite easily and
it's not unknown to have at least printf-style functions as members.
Let's remove the restriction.
show more ...
|
Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init |
|
#
666d2242 |
| 17-Jul-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Fix modernize-use-std-print/format for fmt (#99021)
When fixing #92896 in 0e62d5cf55479981da5e05e406bbca4afb3cdc4f (#94104)
I failed to spot that I'd broken converting from fmt::printf
[clang-tidy] Fix modernize-use-std-print/format for fmt (#99021)
When fixing #92896 in 0e62d5cf55479981da5e05e406bbca4afb3cdc4f (#94104)
I failed to spot that I'd broken converting from fmt::printf,
fmt::fprintf and fmt::sprintf in these checks since the format parameter
of those functions is not a simple character pointer.
The first part of the previous fix to avoid the assert and instead
produce an error message was sufficient. It was only the second part
that required the format parameter of the called function to be a simple
character pointer that was problematic. Let's remove that second part
and add the now-expected error messages to the lit tests along with
fixing the prototype for the fmt functions to more accurately reflect
the ones used by the fmt library so they are actually useful.
Fixes #92896
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7 |
|
#
0e62d5cf |
| 03-Jun-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Fix assert in modernize-use-std-format/print (#94104)
Ensure that FormatStringConverter's constructor fails with a sensible
error message rather than asserting if the format string is
[clang-tidy] Fix assert in modernize-use-std-format/print (#94104)
Ensure that FormatStringConverter's constructor fails with a sensible
error message rather than asserting if the format string is not a narrow
string literal.
Also, ensure that we don't even get that far in modernize-use-std-print
and modernize-use-std-format by checking that the format string
parameter is a char pointer.
Fixes #92896
show more ...
|
Revision tags: llvmorg-18.1.6 |
|
#
af79372d |
| 13-May-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Add modernize-use-std-format check (#90397)
Add a new clang-tidy check that converts absl::StrFormat (and similar
functions) to std::format (and similar functions.)
Split the config
[clang-tidy] Add modernize-use-std-format check (#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 so that we don't risk confusion by passing two
boolean configuration parameters into the constructor. Add
AllowTrailingNewlineRemoval option since we never want to remove
trailing newlines in this check.
show more ...
|
#
7e4d16d7 |
| 05-May-2024 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Improve modernize-use-std-print diagnostic (#91071)
Include the source range of the printf function in the diagnostic so it
gets underlined in the output.
|
Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4 |
|
#
ac800175 |
| 26-Aug-2023 |
Piotr Zegar <me@piotrzegar.pl> |
[clang-tidy][NFC] Fix modernize-use-emplace findings
Fix issues found by clang-tidy in clang-tidy source directory.
|
Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
09ed2102 |
| 28-Jun-2023 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Fix modernize-use-std-print check when return value used
The initial implementation of the modernize-use-std-print check was capable of converting calls to printf (etc.) which used the
[clang-tidy] Fix modernize-use-std-print check when return value used
The initial implementation of the modernize-use-std-print check was capable of converting calls to printf (etc.) which used the return value to calls to std::print which has no return value, thus breaking the code.
Use code inspired by the implementation of bugprone-unused-return-value check to ignore cases where the return value is used. Add appropriate lit test cases and documentation.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D153860
show more ...
|
#
43fa7ea9 |
| 27-Jun-2023 |
Piotr Zegar <me@piotrzegar.pl> |
Revert "[clang-tidy] Fix modernize-use-std-print check when return value used"
This reverts commit 3e12b2e207cfa802937488a2c0b90d482eaf00a9.
|
#
3e12b2e2 |
| 27-Jun-2023 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Fix modernize-use-std-print check when return value used
The initial implementation of the modernize-use-std-print check was capable of converting calls to printf (etc.) which used the
[clang-tidy] Fix modernize-use-std-print check when return value used
The initial implementation of the modernize-use-std-print check was capable of converting calls to printf (etc.) which used the return value to calls to std::print which has no return value, thus breaking the code.
Use code inspired by the implementation of bugprone-unused-return-value check to ignore cases where the return value is used. Add appropriate lit test cases and documentation.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D153860
show more ...
|
#
83f875dc |
| 26-Jun-2023 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with recording a set of casts to wrap the arguments as required and removing now-unnecessary calls to std::string::c_str() and std::string::data()
Use FormatStringConverter to implement a new clang-tidy check that is capable of converting calls to printf, fprintf, absl::PrintF, absl::FPrintF, or any functions configured by an option to calls to std::print and std::println, or other functions configured by options.
In other words, the check turns:
fprintf(stderr, "The %s is %3d\n", description.c_str(), value);
into:
std::println(stderr, "The {} is {:3}", description, value);
if it can.
std::print and std::println can do almost anything that standard printf can, but the conversion has some some limitations that are described in the documentation. If conversion is not possible then the call remains unchanged.
Depends on D153716
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D149280
show more ...
|
#
ec89cb9a |
| 26-Jun-2023 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with recording a set of casts to wrap the arguments as required and removing now-unnecessary calls to std::string::c_str() and std::string::data()
Use FormatStringConverter to implement a new clang-tidy check that is capable of converting calls to printf, fprintf, absl::PrintF, absl::FPrintF, or any functions configured by an option to calls to std::print and std::println, or other functions configured by options.
In other words, the check turns:
fprintf(stderr, "The %s is %3d\n", description.c_str(), value);
into:
std::println(stderr, "The {} is {:3}", description, value);
if it can.
std::print and std::println can do almost anything that standard printf can, but the conversion has some some limitations that are described in the documentation. If conversion is not possible then the call remains unchanged.
Depends on D153716
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D149280
show more ...
|
#
81418ada |
| 25-Jun-2023 |
Mike Crowe <mac@mcrowe.com> |
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with
[clang-tidy] Add modernize-printf-to-std-print check
Add FormatStringConverter utility class that is capable of converting printf-style format strings into std::print-style format strings along with recording a set of casts to wrap the arguments as required and removing now-unnecessary calls to std::string::c_str() and std::string::data()
Use FormatStringConverter to implement a new clang-tidy check that is capable of converting calls to printf, fprintf, absl::PrintF, absl::FPrintF, or any functions configured by an option to calls to std::print and std::println, or other functions configured by options.
In other words, the check turns:
fprintf(stderr, "The %s is %3d\n", description.c_str(), value);
into:
std::println(stderr, "The {} is {:3}", description, value);
if it can.
std::print and std::println can do almost anything that standard printf can, but the conversion has some some limitations that are described in the documentation. If conversion is not possible then the call remains unchanged.
Depends on D153716
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D149280
show more ...
|