[clang] [LifetimeSafety] Add support for `new`/`delete` (PR #192504)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 04:40:07 PDT 2026


================
@@ -615,6 +629,55 @@ void FactsGenerator::VisitArraySubscriptExpr(const ArraySubscriptExpr *ASE) {
       Dst->getOuterOriginID(), Src->getOuterOriginID(), /*Kill=*/true));
 }
 
+void FactsGenerator::VisitCXXNewExpr(const CXXNewExpr *NE) {
+  OriginList *NewList = getOriginsList(*NE);
+
+  // Check if we have a placement new where the second argument is void*, to
+  // avoid flowing from std::nothrow and the placement parameter amount is 1,
+  // that is to mostly limit to standard library placement new
----------------
Xazax-hun wrote:

If you want to limit to the standard library placement new, maybe we should check if the new declared in the `std` namespace.

Nit: terminate comments with a full stop.

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


More information about the cfe-commits mailing list