[clang] [Analyzer][NFC] Remove redundant function call (PR #75076)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 10:29:29 PST 2023


isuckatcs wrote:

> I have also thought about a possible different caller but I think it is very unlikely. These `ExpressionHandler`s are basically visitor like classes for this tracking mechanism, if I am correct. Their purpose is to track other values or append `BugReporterVisitor`s to the `PathSensitiveBugReport`.

Still, here we technically want to turn a safety check into a contract between the function and it's caller. With an assertion added, the callers now know about the contract at the cost of a possible crash. However a contract is still a weaker guarantee than a safety check. 

I don't see why having that safety check bothers us. It's not affecting performance in any significant way, the code is not harder to understand because of it, the function is not less maintainable, etc.

For now, I would like to know what the others think about this change too.

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


More information about the cfe-commits mailing list