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

This patch introduces `DataflowModel`, an abstract base class for dataflow
"models": reusable analysis components that model a particular aspect of program
semantics.

Differential Revision: https://reviews.llvm.org/D121796
This commit is contained in:
Yitzhak Mandelbaum 2022-03-14 21:16:18 +00:00
parent 4001b82b15
commit e0aefb4f92

View File

@ -136,6 +136,15 @@ runDataflowAnalysis(const ControlFlowContext &CFCtx, AnalysisT &Analysis,
return BlockStates;
}
/// Abstract base class for dataflow "models": reusable analysis components that
/// model a particular aspect of program semantics in the `Environment`. For
/// example, a model may capture a type and its related functions.
class DataflowModel : public Environment::ValueModel {
public:
/// Return value indicates whether the model processed the `Stmt`.
virtual bool transfer(const Stmt *Stmt, Environment &Env) = 0;
};
} // namespace dataflow
} // namespace clang