This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Make BreakContinueFinder handle nested loops.
ClosedPublic

Authored by efriedma on Jun 23 2017, 1:09 PM.

Details

Summary

We don't care about break or continue statements that aren't
associated with the current loop, so make sure the visitor
doesn't find them.

Fixes https://bugs.llvm.org/show_bug.cgi?id=32648 .

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Jun 23 2017, 1:09 PM
rsmith accepted this revision.Jun 30 2017, 4:48 PM

LGTM, thanks!

I'm not particularly happy with the number of different places where we duplicate the knowledge of how break/continue bind to enclosing loops, but fixing that seems beyond the scope of this change.

lib/Sema/SemaStmt.cpp
1610

In CodeGen, we don't evaluate the condition within the continue/break scope of the loop... but I'm pretty sure that doesn't matter because only the range statement can contain a break or continue anyway.

This revision is now accepted and ready to land.Jun 30 2017, 4:48 PM
This revision was automatically updated to reflect the committed changes.