diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2016-04-12 23:10:58 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2016-04-12 23:10:58 +0000 |
commit | 2d3690bc986c9d852ffd96f96ba274750ef084b3 (patch) | |
tree | 70328df8e83bf56e94ece9e321653bd894410495 /clang/test/CodeGenObjC/message-arrays.m | |
parent | 16a7d637dd4432cbe35b9088cc339c838c4ea64d (diff) | |
download | bcm5719-llvm-2d3690bc986c9d852ffd96f96ba274750ef084b3.tar.gz bcm5719-llvm-2d3690bc986c9d852ffd96f96ba274750ef084b3.zip |
[ObjC] Pop all cleanups created in EmitObjCForCollectionStmt before
exiting the for-in loop.
This commit fixes a bug where EmitObjCForCollectionStmt didn't pop
cleanups for captures.
For example, in the following for-in loop, a block which captures self
is passed to foo1:
for (id x in [self foo1:^{ use(self); }]) {
use(x);
break;
}
Previously, the code in EmitObjCForCollectionStmt wouldn't pop the
cleanup for the captured self before exiting the loop, which caused
code-gen to generate an IR in which objc_release was called twice on
the captured self.
This commit fixes the bug by entering a RunCleanupsScope before the
loop condition is evaluated and forcing its cleanup before exiting the
loop.
rdar://problem/16865751
Differential Revision: http://reviews.llvm.org/D18618
llvm-svn: 266147
Diffstat (limited to 'clang/test/CodeGenObjC/message-arrays.m')
0 files changed, 0 insertions, 0 deletions