[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr
Mike Crowe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 11 09:45:18 PST 2023
mikecrowe added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:189
+ getLangOpts().CPlusPlus2b
+ ? hasAnyName("::std::print", "::std::format")
+ : hasName("::std::format"))),
----------------
PiotrZSL wrote:
> Please introduce configuration option to specify custom functions.
> For example if some project (like mine) is wrapping fmt::format with some variadic template function, then such function could be specified.
> Same goes to things like some loggers.
>
> Check utils/OptionsUtils.h for configuration, and utils/Matchers.h (matchesAnyListedName)
> Please introduce configuration option to specify custom functions.
> For example if some project (like mine) is wrapping fmt::format with some variadic template function, then such function could be specified.
That's exactly where this change originated (as part of [[ https://github.com/mikecrowe/clang-tidy-fmt | my clang-tidy fmt fork ]], which I hope to submit for review soon once I've made it configurable too and improved the test cases.)
> Same goes to things like some loggers.
>
> Check utils/OptionsUtils.h for configuration, and utils/Matchers.h (matchesAnyListedName)
Thanks for the pointer. I shall study those files for how to support this.
Do you think that the change can land like in its current state first? Or would you prefer that the configuration option is added at the same time?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143342/new/
https://reviews.llvm.org/D143342
More information about the cfe-commits
mailing list