Don't assert when we think we need copy/dispose, but don't need them.

Radar 6838889


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mike Stump 2009-05-01 01:31:57 +00:00
Родитель bad3a94d50
Коммит dd2fb9c5eb
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -158,6 +158,8 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
BlockHasCopyDispose |= subBlockHasCopyDispose; BlockHasCopyDispose |= subBlockHasCopyDispose;
Elts[3] = Fn; Elts[3] = Fn;
// FIXME: Don't use BlockHasCopyDispose, it is set more often then necessary, for
// example: { ^{ __block int i; ^{ i = 1; }(); }(); }
if (subBlockHasCopyDispose) if (subBlockHasCopyDispose)
flags |= BLOCK_HAS_COPY_DISPOSE; flags |= BLOCK_HAS_COPY_DISPOSE;
@ -557,7 +559,6 @@ BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) {
subBlockHasCopyDispose); subBlockHasCopyDispose);
assert(subBlockSize == BlockLiteralSize assert(subBlockSize == BlockLiteralSize
&& "no imports allowed for global block"); && "no imports allowed for global block");
assert(!subBlockHasCopyDispose && "no imports allowed for global block");
// isa // isa
LiteralFields[0] = getNSConcreteGlobalBlock(); LiteralFields[0] = getNSConcreteGlobalBlock();

Просмотреть файл

@ -22,5 +22,9 @@ void *P = ^{
void *Q = __func__; void *Q = __func__;
}; };
void (^test1)(void) = ^(void) {
__block int i;
^ { i = 1; }();
};
// RUN: true // RUN: true