benedekaibas wrote: @NagyDonat
I have applied the changes in: [ba73186](https://github.com/llvm/llvm-project/pull/225489/commits/ba73186b9c234bd110e062a6a8b8ad03a2fd61c3) Instead of inlining `argumentsMayEscape` logic straight into `mayFreeAnyEscapedMemoryOrIsModeledExplicitly` I have created two helper functions. `mayFreeAnyEscapedMemoryOrIsModeledExplicitly` was already large enough. The two helpers need to be called in `mayFreeAnyEscapedMemoryOrIsModeledExplicitly` of course to replace `argumentsMayEscape`. However, this change alone is not enough. `checkPointerEscapeAux` has the following guard: `if (!IsConstPointerEscape || checkIfNewOrNewArrayFamily(RS)`. This guard needs to be appended with OR gates that include the helper functions. Without including the helpers in the if statement const pointer kinds never reach `RefState::getEscaped(RS)`. I have kept `if (!hasVoidPointerToNonConstArg())` in `CallEvent.cpp` as discussed in this PR, but I think it would be good to have a patch for it in a follow up PR once this one is merged (I can work on that too). One thing I am not satisfied with is the `mayFreeOrLetArgumentsEscape` helper function. It still does three things at once: 1) Returns true for callees that take ownership of a buffer and might free it later 2) Returns true for callees that let an argument escape even through a pointer to a const parameter 3) Returns true for a non-null callback argument or a void pointer to non-const argument 2 and 3 come from `argumentsMayEscape()`, but 1 _might_ deserves its own helper. But that means it needs to be called at multiple places probably as well which makes the call sites messier IMO. https://github.com/llvm/llvm-project/pull/225489 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
