[PATCH] Fix to PR8880 (clang dies processing a for loop).

Serge Pavlov sepavloff at gmail.com
Wed Sep 25 20:08:38 PDT 2013


sepavloff added you to the CC list for the revision "Fix to PR8880 (clang dies processing a for loop).".

Due to statement expressions supported as GCC extension, it is possible to put 'break' or 'continue' into a loop/switch statement but outside its body, similar to this:
    for ( ; ({ if (first) { first = 0; continue; } 0; }); )
Such usage must be diagnosed as an error, GCC rejects it.
To recognize such patterns the flags BreakScope and ContinueScope are  temporarily turned off while parsing condition expression.

Please review the fix.
Thank you.

http://llvm-reviews.chandlerc.com/D1762

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Parse/Parser.h
  include/clang/Sema/Scope.h
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/Scope.cpp
  test/Analysis/dead-stores.c
  test/Parser/bad-control.c
  test/Sema/statements.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1762.1.patch
Type: text/x-patch
Size: 11609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130925/d8fe8e67/attachment.bin>


More information about the cfe-commits mailing list