[PATCH] D131039: [clang][dataflow] Add cache of `ControlFlowContext`s for function decls.

Stanislav Gatev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 2 22:35:30 PDT 2022


sgatev added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h:34
+  /// Builds a ControlFlowContext from an AST node. `D` is the function in which
+  /// `S` resides. All arguments must be non-null.
   static llvm::Expected<ControlFlowContext> build(const Decl *D, Stmt *S,
----------------
Can we make them references?


================
Comment at: clang/include/clang/Analysis/FlowSensitive/ControlFlowContext.h:50
 private:
-  ControlFlowContext(std::unique_ptr<CFG> Cfg,
+  // `D` must not be null.
+  ControlFlowContext(const Decl *D, std::unique_ptr<CFG> Cfg,
----------------
Can we make it a reference?


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:369
+
+  // Keyed on the function's fully qualified name. No leading "::".
+  llvm::StringMap<ControlFlowContext> FunctionModels;
----------------
Can we make the keys `FunctionDecl *` and use `FunctionDecl::getDefinition` in `getControlFlowContext` to obtain a canonical pointer?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131039



More information about the cfe-commits mailing list