[PATCH] D54438: [analyzer][WIP] Reimplement dependencies between checkers

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 6 16:34:46 PST 2018


Szelethus added a comment.

In D54438#1322266 <https://reviews.llvm.org/D54438#1322266>, @NoQ wrote:

> In D54438#1315953 <https://reviews.llvm.org/D54438#1315953>, @Szelethus wrote:
>
> > - ✔️ There are in fact a variety of checkers that contain subcheckers like `MallocChecker`, which I think is all good, but the concept that if a subchecker is enabled it only sort of registeres the main checker (in `MallocChecker`'s case it enables modeling, but not reporting) is very hard to follow. I propose that all such checkers should clearly have a base, called something `DynamicMemoryModeling`, or `IteratorModeling` etc.
>
>
> This will be the most time-consuming part, as i imagine. You'll have to split each callback into two callbacks in two different checkers (`PostCall` vs. `PostStmt<CallExpr>` doesn't work!) and make sure that they are called in the correct order. I expect most modeling to go into `PostStmt` ("post-conditions") and most checking go to `PreStmt` ("pre-conditions"). I.e., "if the pre-condition of the statement is not fulfilled, the checker reports a bug. Otherwise, the model enforces the post-condition after the statement"). Some code (eg., on which particular statements does the checker react?) might be annoying to de-duplicate. Not sure how callbacks that don't have pre/post variants will behave.


Actually, it's already implemented, and the beauty of it is that it requires pretty much no change to the checker files. `MallocChecker` is a mess, but splitting it up is avoidable in order to pull this off. I'll probably upload a patch in the coming days with my proposed solution. Super excited about it, actually!

Side note: Before realizing this, I worked out a neat plan to split up `MallocChecker` that addresses all of the issues you mentioned above. I'll share once it I get the time to put together a nice looking proposal -- since everything is so intertwined, I really have to go into tiny details with it, a high level "gonna along the lines of this and that" won't cut it. I already have a bunch of txt files, whiteboards and papers filled with it.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54438/new/

https://reviews.llvm.org/D54438





More information about the cfe-commits mailing list