]> granicus.if.org Git - clang/commit
Produce less broken basic block sequences for __finally blocks.
authorNico Weber <nicolasweber@gmx.de>
Wed, 25 Feb 2015 04:05:18 +0000 (04:05 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 25 Feb 2015 04:05:18 +0000 (04:05 +0000)
commit4a4ee53e9fac4bb0cc610890e50ad30842bc7f8a
tree5bffd3520e2408253b76c0bd7dbd28fd07a792e1
parent38219baaa33f6dd1ae543eccef612936412a8724
Produce less broken basic block sequences for __finally blocks.

The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230460 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGException.cpp
test/CodeGen/exceptions-seh-finally.c