[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 15:23:43 PDT 2024


================
@@ -2256,6 +2256,17 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler {
         Range = UO->getSubExpr()->getSourceRange();
         MsgParam = 1;
       }
+    } else if (const auto *CtorExpr = dyn_cast<CXXConstructExpr>(Operation)) {
+      if (CtorExpr->getConstructor()->getCanonicalDecl()->getNameAsString() ==
+          "span")
----------------
jkorous-apple wrote:

Please ignore if the code above already takes care of this but can we compare the fully qualified name against "std::span" to make sure that we don't get tripped up by classes like `my::nonstd::span`?

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


More information about the cfe-commits mailing list