================
@@ -115,6 +115,15 @@ static const Loan *createLoan(FactManager &FactMgr, const 
CXXNewExpr *NE) {
   return FactMgr.getLoanMgr().createLoan(Path, NE);
 }
 
+/// Creates a loan for a heap allocation made by a call (e.g. a function
+/// annotated with `ownership_returns`, like `malloc`).
+/// \param CE The CallExpr that represents the allocation
+/// \return The new Loan on success, nullptr otherwise
+static const Loan *createLoan(FactManager &FactMgr, const CallExpr *CE) {
+  AccessPath Path(CE);
----------------
Xazax-hun wrote:

This is just a personal preference, but I think it is harder and harder to see 
at the call site what sort of AccessPath are we creating. I wonder if it would 
make sense to migrate to static factories like `auto path = 
AccessPath::newAllocation(CE)`. But this could be a follow-up. 

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

Reply via email to