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

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 04:51:54 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
----------------
NeKon69 wrote:

Wait, I thought `new` can't be declared in namespaces, that's exactly why I didn't put that check in here..

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


More information about the cfe-commits mailing list