zaks.anna added a comment.
Gabor, there is a lot of the same steps that all callbacks go through. I think
refactoring those into subroutines will help with readability of the checker.
Looking forward to seeing a new version soon!
Anna.
================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:607
@@ +606,3 @@
+
+void NullabilityChecker::checkPostStmt(const ExplicitCastExpr *CE,
+ CheckerContext &C) const {
----------------
+ comment
// We trust the explicit casts. If there is a disagreement in nullability
annotations of destination and source or if '0' is casted to a nonnull type,
track the value as having contradictory nullability. This will allow users to
suppress nullability warnings.
================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:618
@@ +617,3 @@
+
+ if (DestNullability == Nullability::Unspecified)
+ return;
----------------
What is users try to suppress a FP using a cast to unspecified?
================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:671
@@ +670,3 @@
+ ProgramStateRef State = C.getState();
+ ConditionTruthVal IsNull = State->isNull(V.castAs<DefinedOrUnknownSVal>());
+ bool RhsIsNull = IsNull.isConstrainedTrue();
----------------
We know that V is not undef here?
================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:676
@@ +675,3 @@
+ Nullability LocNullability = getNullability(LocType);
+ // The null pointer is loaded to a reference is handled in another checker.
+ if (Filter.CheckNullPassedToNonnull && RhsIsNull &&
----------------
This comment is not clear.
http://reviews.llvm.org/D11468
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits