[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

Donát Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 05:40:27 PDT 2025


https://github.com/NagyDonat commented:

Thanks for updating the commit!

I reviewed the tests and added some minor suggestions in the implementation.

Among my earlier suggestions [the visibility of VisitSymbol](https://github.com/llvm/llvm-project/pull/152751/files#r2301055454) and the [complex code duplication question](https://github.com/llvm/llvm-project/pull/152751/files#r2301561854) are still relevant.

Moreover I thought about the approach that you currently emphasize "owning" in every name and comment where you speak about smart pointers. As this is not a distinguishing feature of these functions (you never interact with non-owning smart pointers) and these function names tend to be very long, I think it would be better to omit "owning" from these names. It is enough to mention the exclusion of `weak_ptr` in a single comment (next to the function that recognizes the names of the smart pointer classes).

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


More information about the cfe-commits mailing list