================
@@ -3194,7 +3480,6 @@ void MallocChecker::checkEscapeOnReturn(const ReturnStmt 
*S,
   if (!Sym)
     // If we are returning a field of the allocated struct or an array element,
     // the callee could still free the memory.
-    // TODO: This logic should be a part of generic symbol escape callback.
----------------
ivanmurashko wrote:

The change is not directly related to the PR. I believe that the TODO comment 
became obsolete a long time ago, and I deleted it for that reason. 

The TODO comment was added in February 2012 (see 
4ca45b1d00e97c590bc1bf012bd35b1f73926565) when fixing a false positive in the 
malloc checker related to returning fields of allocated structs or array 
elements via pointer arithmetic. The author of the commit embedded 
escape-on-return logic directly in `checkPreStmt` but recognized this was 
architecturally suboptimal, suggesting it should be part of a "generic symbol 
escape callback" instead.

This TODO was rendered unnecessary when commit 122171e235827 refactored the 
code by extracting the escape logic into a dedicated `checkEscapeOnReturn` 
method that could be reused by multiple callbacks (`checkPreStmt` and 
`checkEndFunction`). This addressed the architectural concern without requiring 
a complete redesign of the symbol escape callback system.

https://github.com/llvm/llvm-project/pull/152751
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to