[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check
Mike Crowe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 26 12:11:56 PDT 2023
mikecrowe added a comment.
If this sort of check is deemed acceptable then I have plans for future improvements, including:
1. Automatically turning absl::StrFormat into fmt::format too (with an option to choose an alternative to `absl::StrFormat`.)
2. Detecting format strings that end in `"\n"` and turning the call into `std::println` rather than `std::print`.
3. It ought to be possible to do something with %m by using `std::error_code`.
4. Support for member functions and even `operator()` for help with converting logging class methods.
My attempts to do something sensible with wide characters failed miserably. I've never used wprintf etc. myself and it would probably require the skills of someone more familiar with them.
Since many other clang-tidy checks are for Abseil, support for `absl::PrintF` and `absl::FPrintF` is built in. They could be removed since it would always be possible to replace them using the provided options.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149280/new/
https://reviews.llvm.org/D149280
More information about the cfe-commits
mailing list