]> granicus.if.org Git - clang/commit
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)
commitf82ff2549c0d3e123333cd1e68819dc7d98d375f
treecfb901411c857b7f86598e4ae117a217431764ff
parente4c37ad3369eea737a6c0b84942e784200a71b13
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231623 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Scope.h
include/clang/Sema/Sema.h
lib/Parse/ParseStmt.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/TreeTransform.h
test/Sema/__try.c