[PATCH] D12445: [Static Analyzer] Remove sinks from nullability checks.

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 13:38:34 PDT 2015


zaks.anna added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:166
@@ +165,3 @@
+  /// report anything and turn off the check.
+  ///
+  /// When \p SuppressPath is set to true, no more bugs will be reported on this
----------------
It is still not clear what the condition is..
More context in the name would be better; for example, how about reportBugIfNotOnDefensiveCodePath or reportBugIfPreconditionHolds

================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:374
@@ +373,3 @@
+  ProgramStateRef OriginalState = N->getState();
+  if (OriginalState->get<PreconditionViolated>())
+    return;
----------------
Shouldn't this be part of checkPreconditionViolation?


================
Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:806
@@ -690,1 +805,3 @@
 
+  ProgramStateRef State = C.getState();
+  if (State->get<PreconditionViolated>())
----------------
Maybe we should only check these at the time the bug is about to be reported.. 

That way the code would be less error prone..


http://reviews.llvm.org/D12445





More information about the cfe-commits mailing list