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

Sam Estep via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 12:50:19 PDT 2022


samestep added inline comments.


================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:210
+                             const DeclContext *Callee) const {
+  return CallString.size() <= MaxDepth &&
+         std::find(CallString.begin(), CallString.end(), Callee) ==
----------------
sgatev wrote:
> If `canDescend` is supposed to return false for `MaxDepth = 0`, shouldn't this be `<`?
I don't follow; could you clarify? The `CallStack` should always be nonempty.


================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:665
+    if (!(Options.ContextSensitiveOpts &&
+          Env.canDescend(Options.ContextSensitiveOpts->Depth, F)))
       return;
----------------
xazax.hun wrote:
> Alternatively, `canDescend` could get the optional `ContextSensitiveOpts` and we can do all the checking there. 
Ah, good idea!


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