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

Stanislav Gatev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 08:48:55 PDT 2022


sgatev added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/Diagnosis.h:26
+template <typename Lattice, typename Diags>
+using Diagnosis =
+    std::function<Diags(const Stmt *, const Lattice &, const Environment &)>;
----------------
Let's add some documentation for `Diagnosis` and `diagnoseCFG`.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/Diagnosis.h:27
+using Diagnosis =
+    std::function<Diags(const Stmt *, const Lattice &, const Environment &)>;
+
----------------
`#include <functional>`


================
Comment at: clang/include/clang/Analysis/FlowSensitive/Diagnosis.h:32
+    const ControlFlowContext &CFCtx,
+    std::vector<llvm::Optional<TypeErasedDataflowAnalysisState>> &BlockStates,
+    const Environment &Env, TypeErasedDataflowAnalysis &Analysis,
----------------
`#include <vector>` and `#include "llvm/ADT/Optional.h"`


================
Comment at: clang/include/clang/Analysis/FlowSensitive/Diagnosis.h:49
+  }
+  return std::move(Diags);
+}
----------------
`#include <utility>`


================
Comment at: clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h:49
+template <typename DiagsT> struct DiagnoseState {
+  DiagnoseState(DiagsT &Diags, const Environment &Env)
+      : Diags(Diags), Env(Env) {}
----------------
Move this to Diagnosis.h?


================
Comment at: clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h:76
 
+class UncheckedOptionalAccessDiagnosis {
+public:
----------------
Move this to a new UncheckedOptionalAccessDiagnosis.(h,cpp)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127898



More information about the cfe-commits mailing list