summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-28 03:32:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-28 03:32:48 +0000
commitcd7a099c1f3636e5d3b6dcd3a6af5006f194fe25 (patch)
treef20a6994bdec6c89cd6be6871cfdb84fee10942f /test
parent721aa37621e047755a45b742160e21f4e879f462 (diff)
downloadclang-cd7a099c1f3636e5d3b6dcd3a6af5006f194fe25.tar.gz
clang-cd7a099c1f3636e5d3b6dcd3a6af5006f194fe25.tar.bz2
clang-cd7a099c1f3636e5d3b6dcd3a6af5006f194fe25.tar.xz
Basic coverage test for conversion-to-block-pointer for lambda expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGenObjCXX/lambda-expressions.mm18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/CodeGenObjCXX/lambda-expressions.mm b/test/CodeGenObjCXX/lambda-expressions.mm
new file mode 100644
index 0000000000..c55699a231
--- /dev/null
+++ b/test/CodeGenObjCXX/lambda-expressions.mm
@@ -0,0 +1,18 @@
+// 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: 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 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