[PATCH] D103605: [analyzer] Introduce a new interface for tracking

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 9 21:47:59 PDT 2021


NoQ added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:160-161
+  PathSensitiveBugReport &Report;
+  std::deque<ExpressionHandlerPtr> ExpressionHandlers;
+  std::deque<StoreHandlerPtr> StoreHandlers;
+
----------------
Empty deques can be pretty large:

> https://en.cppreference.com/w/cpp/container/deque
> e.g. 8 times the object size on 64-bit libstdc++; 16 times the object size or 4096 bytes, whichever is larger, on 64-bit libc++

If we're attaching multiple trackers per non-deduplicated bug report I suspect this can easily amount to like 20-30 MB per process.

I suspect that a list would be cheaper in every way, esp. given that we don't need random access.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:210
+  ///        much.
+  virtual Result track(KnownSVal V, const MemRegion *R,
+                       TrackingOptions Opts = {},
----------------
vsavchenko wrote:
> NoQ wrote:
> > xazax.hun wrote:
> > > Not directly related to this patch, but I wonder if we want to have unknown values with identities at some point, so we can track them.
> > `UnknownVal` is a stop-gap for situations when we've screwed up so badly we don't even have types anymore. The only thing I'd ever want from them is to disappear :)
> > 
> > I guess this could be useful for a debug checker that could explain where does an `UnknownVal` come from. In this case unknown values don't need identities; we can track other values without identities, such as null pointers, just fine.
> +1 for not caring about `UnknownVal`.
That said, I'd rather not force the caller to perform a `getAs<>()`. It's pretty cumbersome and we can do the right thing (ignore it) in the callee anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103605



More information about the cfe-commits mailing list