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

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 18:36:46 PDT 2018


george.karpenkov 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);
+
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D53624





More information about the llvm-commits mailing list