llvm-project
2555f3b0 - [LifetimeSafety] Treat std::unique_ptr::release() as a move operation (#180230)

Commit
3 days ago
[LifetimeSafety] Treat std::unique_ptr::release() as a move operation (#180230) Add support for `std::unique_ptr::release()` in lifetime analysis to avoid false positives when ownership is manually transferred via `release()`. - Added a new function `isUniquePtrRelease()` to detect when `std::unique_ptr::release()` is called - Modified `handleInvalidatingCall()` to mark the unique_ptr as moved when release() is called When manually transferring ownership using `std::unique_ptr::release()`, the lifetime analysis would previously generate false positive use-after-free warnings. This change treats `release()` as a move operation, correctly modeling the ownership transfer semantics and reducing false positives in code that manually manages ownership.
Author
Parents
Loading