[clang] [analyzer] Conversion to CheckerFamily: NullabilityChecker (PR #143735)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 11 08:48:03 PDT 2025
================
@@ -710,29 +706,28 @@ void NullabilityChecker::checkPreStmt(const ReturnStmt *S,
Nullability RetExprTypeLevelNullability =
getNullabilityAnnotation(lookThroughImplicitCasts(RetExpr)->getType());
- bool NullReturnedFromNonNull = (RequiredNullability == Nullability::Nonnull &&
----------------
NagyDonat wrote:
I refactored this code block because the name of this local boolean `NullReturnedFromNonNull` was too similar to the checker frontend `NullReturnedFromNonnull` (which I introduced).
I eliminated the boolean instead of renaming it, because I feel that the old
```c++
bool B = some condition
if (B && other conditions) {
...
}
if (B) {
...
}
```
was less readable than the structure
```c++
if (some conditions) {
if (other conditions) {
...
}
...
}
```
that I'm introducing. (Deeply nested blocks are not ideal, but breaking up a logically coherent block into multiple `if` statements is even worse.)
https://github.com/llvm/llvm-project/pull/143735
More information about the cfe-commits
mailing list