]> granicus.if.org Git - clang/commit
Reland r230460 with a test fix for -Asserts builds.
authorNico Weber <nicolasweber@gmx.de>
Wed, 25 Feb 2015 16:25:00 +0000 (16:25 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 25 Feb 2015 16:25:00 +0000 (16:25 +0000)
commitfcb5402f028c080cb7e25bb7e974bbb4a793e650
treea636eaf27ed6715ec868c810bb9137e04f523846
parent7d6cea258429e300deeefac21ead530db75dae6b
Reland r230460 with a test fix for -Asserts builds.

Original CL description:
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@230503 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGException.cpp
test/CodeGen/exceptions-seh-finally.c