[cfe-dev] Patch: Implement break and continue

Anders Carlsson andersca at mac.com
Mon Jul 16 07:40:55 PDT 2007


15 jul 2007 kl. 22.02 skrev Chris Lattner:

> On Jul 15, 2007, at 9:05 PM, Anders Carlsson wrote:
>> Hello,
>> here's a patch that implements break and continue in for, while  
>> and do loops.
>>
>> Since this is my first encounter ever with LLVM and cfe, the patch  
>> could very well be completely wrong :) I'd love any feedback it  
>> though.
>
> I have to say that this is *not* how I envisioned implementing  
> this: it's actually a much better approach.
>
> Overall, I really like the patch.  Some suggestions:
>
> 1. Instead of having separate break/continue stacks, I'd suggest  
> merging them and using a SmallVector<std::pair> (or a custom struct  
> instead of a pair if you prefer).  For switch stmts (when we  
> support them), we'd just use null as the continue point.
>

Thanks for the comments! Here's a new patch that addresses all of  
them and adds an extra assert that the break/continue stack is empty  
after generating the function body.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: break-continue-in-loops-2.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20070716/b8c1a37c/attachment.txt>
-------------- next part --------------
Anders


More information about the cfe-dev mailing list