[clang] [clang][-Wunsafe-buffer-usage] Warn on annotated unsafe container construction (PR #227108)

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 06:04:02 PDT 2026


================
@@ -674,14 +669,8 @@ static bool isSafeSpanTwoParamConstruct(const CXXConstructExpr &Node,
   auto IsMethodCallToSizedObject = [](const Stmt *Node, StringRef MethodName) {
     if (const auto *MC = dyn_cast<CXXMemberCallExpr>(Node)) {
       const auto *MD = MC->getMethodDecl();
-      const auto *RD = MC->getRecordDecl();
-
-      if (RD && MD)
-        if (auto *II = RD->getDeclName().getAsIdentifierInfo();
-            II && RD->isInStdNamespace())
-          return llvm::is_contained({SIZED_CONTAINER_OR_VIEW_LIST},
-                                    II->getName()) &&
-                 MD->getName() == MethodName;
+      if (MD && MD->getName() == MethodName)
----------------
ymand wrote:

Maybe just `return MD && MD->getName() == MethodName;`?

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


More information about the cfe-commits mailing list