diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGenObjCXX/lambda-expressions.mm | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGenObjCXX/lambda-expressions.mm')
-rw-r--r-- | clang/test/CodeGenObjCXX/lambda-expressions.mm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjCXX/lambda-expressions.mm b/clang/test/CodeGenObjCXX/lambda-expressions.mm new file mode 100644 index 0000000..858cb74 --- /dev/null +++ b/clang/test/CodeGenObjCXX/lambda-expressions.mm @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks -fobjc-arc | FileCheck -check-prefix=ARC %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -fblocks | FileCheck -check-prefix=MRC %s + +typedef int (^fp)(); +fp f() { auto x = []{ return 3; }; return x; } + +// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [5 x i8] c"copy\00" +// MRC: @"\01L_OBJC_METH_VAR_NAME{{.*}}" = internal global [12 x i8] c"autorelease\00" +// MRC: define i32 ()* @_Z1fv( +// MRC: define internal i32 ()* @"_ZZ1fvENK3$_0cvU13block_pointerFivEEv" +// MRC: store i8* bitcast (i8** @_NSConcreteStackBlock to i8*) +// MRC: store i8* bitcast (i32 (i8*)* @"___ZZ1fvENK3$_0cvU13block_pointerFivEEv_block_invoke_0" to i8*) +// MRC: call i32 ()* (i8*, i8*)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 ()* (i8*, i8*)*) +// MRC: call i32 ()* (i8*, i8*)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 ()* (i8*, i8*)*) +// MRC: ret i32 ()* + +// ARC: define i32 ()* @_Z1fv( +// ARC: define internal i32 ()* @"_ZZ1fvENK3$_0cvU13block_pointerFivEEv" +// ARC: store i8* bitcast (i8** @_NSConcreteStackBlock to i8*) +// ARC: store i8* bitcast (i32 (i8*)* @"___ZZ1fvENK3$_0cvU13block_pointerFivEEv_block_invoke_0" to i8*) +// ARC: call i8* @objc_retainBlock +// ARC: call i8* @objc_autoreleaseReturnValue + +typedef int (^fp)(); +fp global; +void f2() { global = []{ return 3; }; } + +// MRC: define void @_Z2f2v() nounwind { +// MRC: store i8* bitcast (i32 (i8*)* @__f2_block_invoke_0 to i8*), +// MRC-NOT: call +// MRC: ret void +// ("global" contains a dangling pointer after this function runs.) + +// ARC: define void @_Z2f2v() nounwind { +// ARC: store i8* bitcast (i32 (i8*)* @__f2_block_invoke_0 to i8*), +// ARC: call i8* @objc_retainBlock +// ARC: call void @objc_release +// ARC: define internal i32 @__f2_block_invoke_0 +// ARC: call i32 @"_ZZ2f2vENK3$_1clEv |