[PATCH] D69726: [analyzer] DynamicSize: Store the dynamic size

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 08:26:11 PST 2019


Charusso marked 3 inline comments as done.
Charusso added a comment.

In D69726#1732334 <https://reviews.llvm.org/D69726#1732334>, @Szelethus wrote:

> Changes to `MallocChecker` really highlight the positive effects of this patch. Nice!


Thanks!



================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:451
   static ProgramStateRef MallocMemAux(CheckerContext &C, const CallExpr *CE,
-                                      const Expr *SizeEx, SVal Init,
+                                      const Expr *SizeExpr, SVal Init,
                                       ProgramStateRef State,
----------------
Szelethus wrote:
> Is it possible to merge these parameters into a single `DynamicSizeInfo` object?
I want to do the opposite so I want to hide such constructors with the global getters and setters to make it easier to use. It turns out you only want to obtain one of its fields at a time, so that it is a bad idea to give you the entire object with multiple metadata. In my mind they will be in a `dynamic` namespace, and we could write that: `dynamic::getSize(State, MR)` or `dynamic::getType(State, MR)`.

I like the idea of creating `Contexts` to store metadata, but this is not the use case of the dynamic information, I think. The `Dynamic*Info` is good for being stored in a map, and other than that it is just boilerplate to obtain the object and call one of its fields which I do not like anymore.


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

https://reviews.llvm.org/D69726





More information about the cfe-commits mailing list