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

Serge Pavlov sepavloff at gmail.com
Tue Jan 7 22:58:58 PST 2014


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, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

Such usage must be diagnosed as an error, GCC rejects it. With this
change clang interprets such constructs as GCC in C++ mode: 'break'
and 'continue' in the 3rd expression refer to the loop itself, in
the 1st and 2nd expressions - to outer loop.

This revision is reincarnation of http://llvm-reviews.chandlerc.com/D2018, which was accidentally closed.

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

Files:
  include/clang/Sema/Scope.h
  lib/Parse/ParseStmt.cpp
  lib/Sema/Scope.cpp
  test/CodeGen/PR8880.c
  test/Parser/bad-control.c
  test/Sema/statements.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2518.1.patch
Type: text/x-patch
Size: 12096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140107/77469b74/attachment.bin>


More information about the cfe-commits mailing list