[PATCH] D145463: [Inliner][NFC] Remove redundant nullptr check

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:59:52 PST 2023


mtrofin added a comment.

In D145463#4175819 <https://reviews.llvm.org/D145463#4175819>, @AlexM wrote:

> In D145463#4175715 <https://reviews.llvm.org/D145463#4175715>, @mtrofin wrote:
>
>> Would adding an `assert(Callee && "Expected to be non-null due to check at the start of the loop")` (or something like that) above the `if`-check make Coverity happy?
>
> Either removing the check completely or moving it from the `if` to an `assert` will make Coverity happy. Would the assert be preferable to complete removal from a stylistic/readability perspective?

my preference would be to have an assert, the nullcheck is quite far above, and who knows what future changes will look like; an assert close to the use communicates to the future developer that "this here is intentionally assumed so, because (the comment)".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145463/new/

https://reviews.llvm.org/D145463



More information about the llvm-commits mailing list