[clang] [Clang][UnsafeBufferUsage] Warn about two-arg string_view constructors. (PR #180471)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 18:53:46 PST 2026


================
@@ -78,7 +78,7 @@ void test_writes_from_span(std::span<int> sp) {
 }
 
 void test_reads_to_span(A a, A b) {
-  //expected-warning at +1{{the two-parameter std::span construction is unsafe as it can introduce mismatch between buffer size and the bound information}}
----------------
ziqingluo-90 wrote:

@pjalwadi
This doesn't look right to me.  We need to show `std::span` instead of `span` and keep the old warning message unchanged.

Other parts look good to me, thanks for the effort.  Since you already have an approval, feel free to merge after fixing this issue, if I don't revisit this PR soon enough.

https://github.com/llvm/llvm-project/pull/180471


More information about the cfe-commits mailing list