[clang] [-Wunsafe-buffer-usage] Add a new warning for uses of std::span two-parameter constructors (PR #77148)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 16:43:23 PST 2024


================
@@ -2256,6 +2256,10 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler {
         Range = UO->getSubExpr()->getSourceRange();
         MsgParam = 1;
       }
+    } else if (const auto *CtorExpr = dyn_cast<CXXConstructExpr>(Operation)) {
+      S.Diag(CtorExpr->getLocation(),
+             diag::warn_unsafe_buffer_usage_in_container)
+          << 0;
----------------
jkorous-apple wrote:

Assuming we remove the warning message parameter we should not pass the argument here.

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


More information about the cfe-commits mailing list