[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check
Mike Crowe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 15 12:32:43 PDT 2023
mikecrowe updated this revision to Diff 522300.
mikecrowe added a comment.
Implement review comments
I believe that I've now addressed all review comments. In particular:
- Use `println` if format string ends in `\n`, which required adding an extra replacement function configuration option.
- Remove `c_str` as part of the same check. I'm not really sure whether I've done this the right way, but it seems to work. I split some functionality out of the existing readability-redundant-string-cstr check in a separate change to support this. I needed to add an `isRealChar` AST matcher, which might be better somewhere else.
- Warnings are now emitted to explain why conversion is not possible.
In addition, I have also:
- Greatly improved turning signed integer types into their unsigned equivalents and vice-versa so that fixed-width integer types are now supported whether in the `std` namespace or not. This required adding dummy `cstddef` and `cstdint` headers.
- Added and fixed bugs in a few other test cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149280/new/
https://reviews.llvm.org/D149280
Files:
clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.h
clang-tools-extra/clang-tidy/utils/CMakeLists.txt
clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
clang-tools-extra/clang-tidy/utils/FormatStringConverter.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cstddef
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cstdint
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cstdio
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/stdio.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string.h
clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print-absl.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print-custom.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print-fmt.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149280.522300.patch
Type: text/x-patch
Size: 124302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230515/73df4689/attachment-0001.bin>
More information about the cfe-commits
mailing list