vbvictor wrote:

> Well, I forgot that such pattern can be intentional for trimming the string 
> until first `\0`:
> 
> ```c++
>     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?

I'm not sure how widely used this pattern is.
If anyone want such behavior, can they create a remporary variable to cleary 
indicate the intent?

Or you already need this option for your codebase? I'm fine if we do 
off-by-default option.

https://github.com/llvm/llvm-project/pull/181473
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to