[PATCH] D132377: [clang][dataflow] Add `SetupTest` parameter for `AnalysisInputs`.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 10:51:43 PDT 2022


gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:106
+  /// `BlockStates` field which is only computed later during the analysis.
+  std::function<llvm::Error(AnalysisOutputs &)> SetupTest = nullptr;
+
----------------
Since SetupTest runs before PostVisitCFG, could we declare them in order?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:256
+  llvm::DenseMap<const Stmt *, std::string> StmtToAnnotations;
+  AI.SetupTest = [&StmtToAnnotations, SetupTest = std::move(AI.SetupTest)](
+                     AnalysisOutputs &AO) -> llvm::Error {
----------------



================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:263
+    }
+    StmtToAnnotations = *MaybeStmtToAnnotations;
+    return SetupTest ? SetupTest(AO) : llvm::Error::success();
----------------
std::move?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:274
+  std::vector<std::pair<std::string, StateT>> AnnotationStates;
+  auto PostVisitCFG = AI.PostVisitCFG;
+  AI.PostVisitCFG = [&StmtToAnnotations, &AnnotationStates,
----------------
Unused variable?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:276
+  AI.PostVisitCFG = [&StmtToAnnotations, &AnnotationStates,
+                     PostVisitCFG = std::move(AI.PostVisitCFG)](
+                        ASTContext &Ctx, const CFGElement &Elt,
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132377



More information about the cfe-commits mailing list