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

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 11:28:16 PDT 2026


================
@@ -2663,6 +2663,213 @@ int *noreturn_dead_nested(bool cond, bool cond2, int *num) {
 
 } // namespace conditional_operator_control_flow
 
+namespace heap_allocation {
+
+//===----------------------------------------------------------------------===//
+// new
+//===----------------------------------------------------------------------===//
----------------
usx95 wrote:

Can you also test lifetime suggestions and inference in the corr test file.

```cpp
View* MakeView(const MyObj& in) {
  return new View(in);
}

void uar() {
  View* v = MakeView(MyObj{});
  (void)v;
}
```

Similarly test for dangling field (in ctor and member fn.

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


More information about the cfe-commits mailing list