This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Support range-for loops in fixpoint algorithm.
ClosedPublic

Authored by ymandel on Aug 25 2023, 7:49 AM.

Details

Summary

Adds support for recognizing range-for loops in the main algorithm for computing
the model fixpoint.

Diff Detail

Event Timeline

ymandel created this revision.Aug 25 2023, 7:49 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: martong. · View Herald Transcript
ymandel requested review of this revision.Aug 25 2023, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 7:49 AM
xazax.hun accepted this revision.Aug 25 2023, 8:41 AM
This revision is now accepted and ready to land.Aug 25 2023, 8:41 AM
mboehme accepted this revision.Aug 28 2023, 1:17 AM
mboehme added inline comments.
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
114

Making this purely a comment might risk getting it attached to the wrong method.

Consider adding an empty VisitCXXForRangeStmt(), which would make the "do nothing" behavior explicit in code?

clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
1631

Is this check (and the (void)0 with the [[after_loop] annotation) actually needed?

IIUC, the condition we want to test is that the analysis converges. The fact that it produces a Results entry for [[after_loop]] is really more a check of the testing infrastructure rather than the analysis itself?

ymandel updated this revision to Diff 553929.Aug 28 2023, 7:45 AM
ymandel marked 2 inline comments as done.

address review comments

clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp
1631

Correct. I thought it would be useful to include some expectations, but those are really quite independent, so I've removed them. We could go further and call runAnalysis instead of runDataflow, but I prefer the latter for consistency (in terms of build args and the like) with the other tests in this suite.

ymandel updated this revision to Diff 553958.Aug 28 2023, 8:59 AM

clang-format