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

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 04:51:53 PDT 2026


================
@@ -47,20 +47,22 @@ class AccessPath {
     ValueDecl,
     MaterializeTemporary,
     PlaceholderParam,
-    PlaceholderThis
+    PlaceholderThis,
+    HeapAllocation,
   };
 
 private:
   Kind K;
-  const llvm::PointerUnion<const clang::ValueDecl *,
-                           const clang::MaterializeTemporaryExpr *,
-                           const ParmVarDecl *, const CXXMethodDecl *>
+  const llvm::PointerUnion<
+      const clang::ValueDecl *, const clang::MaterializeTemporaryExpr *,
+      const ParmVarDecl *, const CXXMethodDecl *, const CXXNewExpr *>
----------------
NeKon69 wrote:

Yes, well, I agree that we might eventually need to support `malloc`/`free` too, but since I didn’t know about those attributes for marking an allocating function, I just went with the simplest approach.

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


More information about the cfe-commits mailing list