[PATCH] D140694: [clang][dataflow] Only model struct fields that are used in the function being analyzed.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 27 09:59:13 PST 2022


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


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:147-148
 
+  // Returns the subset of fields of `Type` that are referenced in the scope of
+  // the analysis.
+  llvm::DenseSet<const FieldDecl *> getReferencedFields(QualType Type);
----------------



================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:378
+
+  // The set of all fields referenced in the scope of the analysis.
+  llvm::DenseSet<const FieldDecl *> FieldsReferencedInScope;
----------------



================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:455
 
+  // Assign storage locations and values to all variables in `Vars`.
+  void initVars(llvm::DenseSet<const VarDecl *> Vars);
----------------



================
Comment at: clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp:61
+    // Use both fields to force them to be created with `createValue`.
+    void Usage (Recursive R) { (void)R.X; (void)R.R; }
   )cc";
----------------



================
Comment at: clang/unittests/Analysis/FlowSensitive/TestingSupport.h:167
   tooling::FileContentMappings ASTBuildVirtualMappedFiles = {};
+  /// Optional. Enables context-sensitive analysis when constructing the
+  /// `DataflowAnalysisContext`.
----------------
It is not clear what "optional" means for a boolean.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140694



More information about the cfe-commits mailing list