[clang] e0aefb4 - [clang][dataflow] Add an API for dataflow "models" -- reusable analysis components.
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 16 12:48:10 PDT 2022
Author: Yitzhak Mandelbaum
Date: 2022-03-16T19:47:57Z
New Revision: e0aefb4f92782f0679470ee3834801977199a1b1
URL: https://github.com/llvm/llvm-project/commit/e0aefb4f92782f0679470ee3834801977199a1b1
DIFF: https://github.com/llvm/llvm-project/commit/e0aefb4f92782f0679470ee3834801977199a1b1.diff
LOG: [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
Added:
Modified:
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
Removed:
################################################################################
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index b5a7c061e17bb..40bace44ffbd5 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -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
More information about the cfe-commits
mailing list