Provide a way for users to check if a flow condition is
unconditionally true.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This allows me to query when an expression is always encountered/executed. Alternatively, if I have a set of interesting expressions, I can note the flow condition at every expression, compute the disjunction of the set of flow conditions, and determine if execution will always encounter an interesting expression.
The code looks good to me too. I was also wondering what sort of check will need this info.
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h | ||
---|---|---|
176–177 | ||
clang/unittests/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp | ||
144 | ||
151 | I don't think this is doing what the comment above it says. We probably shouldn't add flow conditions directly as constraints because this isn't tracking flow condition dependencies. I suggest removing this case and keeping the one with FC5. | |
154 | Again, I suggest removing this case. The one with FC6 should suffice. |
I'm playing around with a tool to take raw pointers and add a non-null annotation or convert them to references, for code that is assumed to be correct. So in this case, "interesting expression" is anything that would be UB if the pointer was null, e.g. dereferencing the pointer.
Ah, good catch regarding the flow condition deps not being tracked. Thanks for the review!