diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-02-14 06:46:55 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-02-14 06:46:55 +0000 |
commit | f1b3fc73562d726b3bc23a8e7496d1544a80b47f (patch) | |
tree | 57509e4051a74ac39ff8e9e53ffab519e677cdc6 /clang/test/CodeGenObjCXX/lambda-expressions.mm | |
parent | ece84cd10c68f98c18bda52be4e178b2493f7ece (diff) | |
download | bcm5719-llvm-f1b3fc73562d726b3bc23a8e7496d1544a80b47f.tar.gz bcm5719-llvm-f1b3fc73562d726b3bc23a8e7496d1544a80b47f.zip |
[CodeGen][ObjC] Use the type of the captured field of the enclosing
block or lambda.
This is a follow-up to r281682, which fixed a bug in computeBlockInfo
where the captured VarDecl's type, rather than the captured field type
of the enclosing lambda or block, was used to compute the layout of a
block.
This commit makes similar changes to enterBlockScope. This is necessary
to correctly determine whether a block capture requires cleanup.
rdar://problem/30388124
llvm-svn: 295034
Diffstat (limited to 'clang/test/CodeGenObjCXX/lambda-expressions.mm')
-rw-r--r-- | clang/test/CodeGenObjCXX/lambda-expressions.mm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjCXX/lambda-expressions.mm b/clang/test/CodeGenObjCXX/lambda-expressions.mm index 7ac7a2137fb..c8247e2e0a2 100644 --- a/clang/test/CodeGenObjCXX/lambda-expressions.mm +++ b/clang/test/CodeGenObjCXX/lambda-expressions.mm @@ -71,6 +71,10 @@ void take_block(void (^block)()) { block(); } // ARC: %[[CAPTURE1:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %[[BLOCK]], i32 0, i32 5 // ARC: store i32 %{{.*}}, i32* %[[CAPTURE1]] +// ARC-LABEL: define internal void @"_ZZ10-[Foo foo]ENK3$_4clEv"( +// ARC-NOT: @objc_storeStrong( +// ARC: ret void + // ARC: define internal void @"___ZZN13LambdaCapture4foo1ERiENK3$_3clEv_block_invoke" // ARC: %[[CAPTURE2:.*]] = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>, <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 }>* %{{.*}}, i32 0, i32 5 // ARC: store i32 %{{.*}}, i32* %[[CAPTURE2]] @@ -124,6 +128,15 @@ namespace BlockInLambda { }; } +@interface NSObject @end +@interface Foo : NSObject @end +@implementation Foo +- (void)foo { + [&] { + ^{ (void)self; }(); + }(); +} +@end // ARC: attributes [[NUW]] = { noinline nounwind{{.*}} } // MRC: attributes [[NUW]] = { noinline nounwind{{.*}} } |