[clang] [Clang][UnsafeBufferUsage] Warn about two-arg string_view constructors. (PR #180471)
Prajwal P J via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 02:56:35 PST 2026
pjalwadi wrote:
@ziqingluo-90, Thanks for the review! I’ve updated the PR with the following:
Consolidated warnings into warn_unsafe_buffer_usage_in_container using a %0 parameter for the class name. Added the UnsafeBufferUsageInStringView group for targeted suppression.
I investigated isPtrBufferSafe but kept the specialized logic for string_view. The current helper is too strict for substrings (uses == instead of >=) and lacks StringLiteral length checks, which are core to this safety feature.
Updated handleUnsafeOperationInContainer to pass the container name, ensuring existing std::span tests remain correct.
https://github.com/llvm/llvm-project/pull/180471
More information about the cfe-commits
mailing list