[clang-tools-extra] [clang-tidy] Add a new check 'performance-string-view-conversions' (PR #174288)
Zinovy Nis via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 27 09:52:04 PST 2026
irishrover wrote:
> > A low-effort but safe fix would be to always wrap the replacement in std::string_view(...) (or usage of sv suffix if appropriate). WDYT?
>
> I'd leave it as it is. Because overriding `std::string_view` + `char*` is a bad pattern anyway. Suffix ""sv is C++17-and-later only ~C++20-and-later only~. And wrapping with `std::string_view(...)` will make the code too noisy IMO.
>> Because overriding `std::string_view` + `char*` is a bad pattern anyway
Well, maybe it's a bad pattern, but it the only way to mix string_view and string&&:
https://source.chromium.org/chromium/chromium/src/+/main:base/values.h;l=161?q=base::Value&ss=chromium
https://github.com/llvm/llvm-project/pull/174288
More information about the cfe-commits
mailing list