[PATCH] D130726: [clang][dataflow] Handle multiple context-sensitive calls to the same function

Sam Estep via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 14:12:44 PDT 2022


samestep added inline comments.


================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:227
+
+    const VarDecl *Param = *ParamIt;
+    auto &Loc = Env.createStorageLocation(*Param);
----------------
ymandel wrote:
> maybe mention in the patch description that it also improves the modeling of parameter initialization?
Good point; done.


================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:236
+      Env.setValue(Loc, *ArgVal);
+    }
   }
----------------
ymandel wrote:
> Add an `else` that calls `createValue` on the decl's type, and then sets it, like `VisitDeclStmt`?
Ah yes, I meant to do this before but forgot; will do that now.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:3963
 
+TEST(TransferTest, ContextSensitiveSetBothTrueAndFalse) {
+  std::string Code = R"(
----------------
ymandel wrote:
> Are there more scenarios testable at this point? e.g
> 1. 2 layers of callees
> 2. more than one line of code inside the body?
> 3. one than one CFG block in the body?
> 
> If so, please add tests for those that are supported.
1. This currently isn't supported.
2. This should work.
3. This should work.

For (2) and (3), should I add those tests now, or do that in a followup patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130726



More information about the cfe-commits mailing list