-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
README: Add link to merged clang-tidy check #3515
README: Add link to merged clang-tidy check #3515
Conversation
A much-improved version of the main clang-tidy-fmt check for converting printf and fprintf has landed in upstream LLVM. It converts to std::print by default, but can be configured to convert to fmt::print instead. It makes more sense for the README to point to that version instead now.
Since you're the world experts on the format specification syntax, it would Thanks! |
Thank you! In https://github.com/llvm/llvm-project/blob/fc37f717770acdfe5504bb9b969a01bb16a187f9/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp#L339C34-L339C36 Also note that the order of dynamic width/precision and the argument it applies to should be reversed in https://github.com/llvm/llvm-project/blob/fc37f717770acdfe5504bb9b969a01bb16a187f9/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp#L1025 and elsewhere. |
LLVM FileCheckexpects anything in
which is almost what I needed.
Thanks for the review. I shall try to implement that - if I can fathom out how! |
Hopefully fixed by D154283. Thanks for pointing out the flaw. It was easier to fix than I expected. |
…print Victor Zverovich pointed out[1] that printf takes the field width and precision arguments before the value to be printed whereas std::print takes the value first (unless positional arguments are used.) Many of the test cases in use-std-print.cpp were incorrect. Teach the check to rotate the arguments when required to correct this. Correct the test cases and add more. [1] fmtlib/fmt#3515 (comment) Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D154283
…print Victor Zverovich pointed out[1] that printf takes the field width and precision arguments before the value to be printed whereas std::print takes the value first (unless positional arguments are used.) Many of the test cases in use-std-print.cpp were incorrect. Teach the check to rotate the arguments when required to correct this. Correct the test cases and add more. [1] fmtlib/fmt#3515 (comment) Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D154283
A much-improved version of the main clang-tidy-fmt check for converting printf and fprintf has landed in upstream LLVM. It converts to std::print by default, but can be configured to convert to fmt::print instead. It makes more sense for the README to point to that version instead now.