[PATCH] D53624: [analyzer] For now model that OSDynamicCast never returns 0

Artem Dergachev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 19:34:53 PDT 2018


NoQ added inline comments.


================
Comment at: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp:813-814
+      // output are non-zero.
+      if (auto L = RetVal.getAs<DefinedOrUnknownSVal>())
+        state = state->assume(*L, /*Assumption=*/true);
+
----------------
george.karpenkov wrote:
> NoQ wrote:
> > If assume fails and yields a null state, you shouldn't transition into that state; it won't generate a sink but will instead transition into the original state (with the original program point but with checker tag).
> That does not seem to be true: `addTransition` sets `Tag` to `nullptr` by default, and then `addTransitionImpl` has the following lines: 
> 
> ```
> if (!State || (State == Pred->getState() && !Tag && !MarkAsSink))
>       return Pred;
> ```
> 
> So if we create a transition to an empty state, that simply returns the original state, which caches out.
Aha, aha, that's right, i was wrong and confused it with `generateNonFatalErrorNode()`.

*runs away and blames API*


Repository:
  rL LLVM

https://reviews.llvm.org/D53624





More information about the llvm-commits mailing list