This patch adds a Depth field (default value 2) to ContextSensitiveOptions, allowing context-sensitive analysis of functions that call other functions. This also requires replacing the DeclCtx field on Environment with a CallString field that contains a vector of decl contexts, to ensure that the analysis doesn't try to analyze recursive or mutually recursive calls (which would result in a crash, due to the way we handle StorageLocations).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h | ||
---|---|---|
395 | ||
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp | ||
210 | If canDescend is supposed to return false for MaxDepth = 0, shouldn't this be <? | |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
4033 | Let's add a similar test with Depth set to 0. |
Once the Stanislav's comments are resolved, it looks good to me.
clang/lib/Analysis/FlowSensitive/Transfer.cpp | ||
---|---|---|
665 | Alternatively, canDescend could get the optional ContextSensitiveOpts and we can do all the checking there. |
clang/lib/Analysis/FlowSensitive/Transfer.cpp | ||
---|---|---|
665 | Oh... actually that doesn't work quite so nicely, because it introduces a circular dependency between Transfer.h and DataflowEnvironment.h. I'll leave it as-is for now. |