balazs-benics-sonarsource wrote:

> Overall I agree with these comments.
> 
> However, note that in `MallocChecker.cpp` we already have precedent for code 
> that performs `EvalCall` for user-defined functions if they are marked by 
> ownership annotations:
> 
> https://github.com/llvm/llvm-project/blob/98d43ef2d842eb8b552b244a4ed6218d757682a1/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp#L1709

I am aware. That case is justified because we have enough hints about the 
semantics. So it's fine.
In general, it's more borderline for all operator news.

> Once I though about introducing an "EvalCall, but if the function cannot be 
> inlined" callback, but it was shelved for some reason that I don't recall. 
> Perhaps it should be resurrected for situations like this?

We need APIs for controlling what gets certainly inlined, and what gets 
definitely not inlined.
For exampe, `std::sort` should never be inlined, but any member functions of 
`std::array` should be always inlined.
As of today, we have no means to control this.
What you propose also makes sense, but I'd say a bit more niche use case.

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

Reply via email to