[clang-tools-extra] [clang-tidy] perf-str-view-conv improvement: support c_str/data fixing (PR #181473)
Zinovy Nis via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 14 22:47:02 PST 2026
irishrover wrote:
Well, I forgot that such pattern can be intentional for trimming the string until first `\0`:
```cpp
std::string_view sv("123\0""456", 7);
assert(sv.size() == strlen(std::string(sv).c_str())); // 7 vs 3
```
As a workaround I can add an option to disable fixing such patterns while still warning.
WDYT?
https://github.com/llvm/llvm-project/pull/181473
More information about the cfe-commits
mailing list