[PATCH] D131809: [clang][dataflow] Add an option for context-sensitive depth

Stanislav Gatev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 07:49:23 PDT 2022


sgatev added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:395
   // `DeclContext` of the block being analysed if provided.
-  const DeclContext *DeclCtx = nullptr;
+  std::vector<const DeclContext *> CallString;
 
----------------



================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:210
+                             const DeclContext *Callee) const {
+  return CallString.size() <= MaxDepth &&
+         std::find(CallString.begin(), CallString.end(), Callee) ==
----------------
If `canDescend` is supposed to return false for `MaxDepth = 0`, shouldn't this be `<`?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:4003
 
-TEST(TransferTest, ContextSensitiveSetTwoLayers) {
+TEST(TransferTest, ContextSensitiveSetTwoLayersDepthOne) {
   std::string Code = R"(
----------------
Let's add a similar test with `Depth` set to 0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131809



More information about the cfe-commits mailing list