[PATCH] D27710: [analyzer] Prohibit ExplodedGraph's edges duplicating

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 07:07:26 PST 2017


NoQ added a comment.



In https://reviews.llvm.org/D27710#650396, @ilya-palachev wrote:

> I don't understand why the following test passes, because each of two checkers: `MallocChecker` and `SimpleStreamChecker` are using `generateNonFatalErrorNode` method:


That's because error nodes generated by different checkers have different program point, because they have different program point tags, because //their tag is the checker// that throws the report.

I'm referring to this funny code in Checker.h:473:

  class CheckerBase : public ProgramPointTag



In https://reviews.llvm.org/D27710#650396, @ilya-palachev wrote:

> > As Artem points out, the checkers in tree do not create a node for every bug reported - there is no reason to do that.
>
> Yes... But why does `generateNonFatalErrorNode` return `nullptr` in case when the node already exists? Isn't it designed so that to prevent multiple reports being thrown for the same node? If so, then the code contains a lot of such checks.


I do not have a certain answer (i.e. bugs me as well), but this behavior allows knowing if this checker has already reported a bug on a different path that leads to the same predecessor node and therefore to the same error node.

So the use-case i'm a bit worried about is when a checker finds the same error node on a different path and suddenly wants to throw a different report (by bug kind). But i think it's normally impossible because the checker is never, in any callback, aware of the path it took before reaching the predecessor node, only the node itself.

I think i lost track of the original question's discussion>< Do we still believe that duplicated edges are a problem?


Repository:
  rL LLVM

https://reviews.llvm.org/D27710





More information about the cfe-commits mailing list