[PATCH] D127898: [clang][dataflow] Add API to separate analysis from diagnosis

Sam Estep via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 09:06:09 PDT 2022


samestep updated this revision to Diff 439045.
samestep added a comment.

Comment Diagnosis.h and add missing headers


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127898

Files:
  clang/include/clang/Analysis/FlowSensitive/Diagnosis.h


Index: clang/include/clang/Analysis/FlowSensitive/Diagnosis.h
===================================================================
--- clang/include/clang/Analysis/FlowSensitive/Diagnosis.h
+++ clang/include/clang/Analysis/FlowSensitive/Diagnosis.h
@@ -18,14 +18,22 @@
 #include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
 #include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/Optional.h"
+#include <functional>
+#include <utility>
+#include <vector>
 
 namespace clang {
 namespace dataflow {
 
+/// Looks at a single statement using the `Lattice` and `Environment` at that
+/// program point from running a dataflow analysis, and returns any diagnostics.
 template <typename Lattice, typename Diags>
 using Diagnosis =
     std::function<Diags(const Stmt *, const Lattice &, const Environment &)>;
 
+/// Collects diagnostics from all blocks in a CFG, given some dataflow analysis
+/// results and a `Diagnose` function which can be run on individual statements.
 template <typename Lattice, typename Diag>
 llvm::DenseSet<Diag> diagnoseCFG(
     const ControlFlowContext &CFCtx,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127898.439045.patch
Type: text/x-patch
Size: 1158 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220622/9a4d26b2/attachment.bin>


More information about the llvm-commits mailing list