Warn when jumping out of a __finally block via continue, break, return, __leave.
authorNico Weber <nicolasweber@gmx.de>
Mon, 9 Mar 2015 02:47:59 +0000 (02:47 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 9 Mar 2015 02:47:59 +0000 (02:47 +0000)
commitd64657f2989f0e1e279f1ad8a03f627b4b60f407
tree771755984c567efb57fd15d7c16b463fbd2501e7
parent9af63b22a5e5e3f5dc921dc987ccf96dabb87b43
Warn when jumping out of a __finally block via continue, break, return, __leave.

Since continue, break, return are much more common than __finally, this tries
to keep the work for continue, break, return O(1).  Sema keeps a stack of active
__finally scopes (to do this, ActOnSEHFinally() is split into
ActOnStartSEHFinally() and ActOnFinishSEHFinally()), and the various jump
statements then check if the current __finally scope (if present) is deeper
than then destination scope of the jump.

The same warning for goto statements is still missing.

This is the moral equivalent of MSVC's C4532.

llvm-svn: 231623
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Scope.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseStmt.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/TreeTransform.h
clang/test/Sema/__try.c