mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-10 19:34:29 +00:00
Don't enter cleanups for unreachable variables. It's impossible to
jump into these scopes, and the cleanup-entering code sometimes wants to do some operations first (e.g. a GEP), which can leave us with unparented IR. llvm-svn: 154684
This commit is contained in:
parent
cbbdaa9378
commit
8c38d35b05
@ -491,6 +491,8 @@ static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF,
|
||||
/// a full-expression so that the block's cleanups are pushed at the
|
||||
/// right place in the stack.
|
||||
static void enterBlockScope(CodeGenFunction &CGF, BlockDecl *block) {
|
||||
assert(CGF.HaveInsertPoint());
|
||||
|
||||
// Allocate the block info and place it at the head of the list.
|
||||
CGBlockInfo &blockInfo =
|
||||
*new CGBlockInfo(block, CGF.CurFn->getName());
|
||||
|
@ -1171,6 +1171,10 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
|
||||
// If this was emitted as a global constant, we're done.
|
||||
if (emission.wasEmittedAsGlobal()) return;
|
||||
|
||||
// If we don't have an insertion point, we're done. Sema prevents
|
||||
// us from jumping into any of these scopes anyway.
|
||||
if (!HaveInsertPoint()) return;
|
||||
|
||||
const VarDecl &D = *emission.Variable;
|
||||
|
||||
// Check the type for a cleanup.
|
||||
|
@ -23,3 +23,13 @@ int main()
|
||||
// CHECK: call void @_Block_object_assign
|
||||
// CHECK: define internal void @__destroy_helper_block_
|
||||
// CHECK: call void @_Block_object_dispose
|
||||
|
||||
// rdar://problem/11135650
|
||||
namespace test1 {
|
||||
struct A { int x; A(); ~A(); };
|
||||
|
||||
void test() {
|
||||
return;
|
||||
__block A a;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user