[PATCH] D121796: [clang][dataflow] Add an API for dataflow "models" -- reusable analysis components.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 12:04:25 PDT 2022


ymandel marked 3 inline comments as done.
ymandel added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:150-151
+///    should relate to each other -- that is, how they should compose. Open
+///    questions include: Do we want to enable composition of models that have
+///    different lattice types? Do we want to support models with no lattices
+///    that only use the Environment?
----------------
xazax.hun wrote:
> I think supporting different lattice types is a must for a good composability model. E.g., in an ideal world when we have a lattice for constant propagation of integers and we have a model for `std::optional`, it would be great if we could do constant propagation to/from non-empty optionals of integers. 
Agreed. And, fwiw, my stacked patch with a very small model does not involve the lattice.  For the optional checker, we plan to split it into a model and a separate analysis which handles the lattice.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:152
+///    different lattice types? Do we want to support models with no lattices
+///    that only use the Environment?
+///
----------------
xazax.hun wrote:
> The Clang Static Analyzer is full of modeling that has no dedicated state, it will just update the equivalent of an environment (e.g., adding a range to the returned values): https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp#L1208
> 
> Once we have a framework that can reason about integers, I think having something similar (or even better, somehow being able to reuse these summaries across CSA and dataflow) would be awesome.
I removed the lattice dependency and reworded the description to focus on the environment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121796



More information about the cfe-commits mailing list