Ensure that the expressions associated with terminators are associated with a
value. Otherwise, we can generate degenerate flow conditions, where both
branches share the same condition.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp | ||
---|---|---|
125–138 | Turns out this code was overkill -- the conditions are rvalues (even lvalues have an implicit cast inserted), so regardless of any pre-existing form, we should just replace it unconditionally with a simple boolean representation. I've added a new test, though, for fields (vs the existing one for functions), which should exercise the path of Loc != nullptr, vs the function which (with current implementation) will exercise Loc == nullptr. |
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp | ||
---|---|---|
110 | I am still not convinced why would we ever need SkipPast, as the AST will always have the necessary LValueToRValue conversions when we need to look past references. But this is unrelated to this patch. | |
119 | I think this get or create pattern is getting more and more widespread. At some point we might want a helper. |
Thanks for the review!
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp | ||
---|---|---|
110 | Agreed. But, I tried to pull out the SkipPast and it crashed (hence the FIXME). I'll try to track down what's happening, but it may be related to our conflation of ReferenceValue for normal lvalues and reference-typed declarations. Regardless, we want to reconsider our treatment of the different value classes. | |
119 | agreed. Added fixme. |
clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp | ||
---|---|---|
884 | What does "abstract" mean here? Perhaps "arbitrary"? |
I am still not convinced why would we ever need SkipPast, as the AST will always have the necessary LValueToRValue conversions when we need to look past references. But this is unrelated to this patch.