From cd7a099c1f3636e5d3b6dcd3a6af5006f194fe25 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 28 Feb 2012 03:32:48 +0000 Subject: [PATCH] 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 --- test/CodeGenObjCXX/lambda-expressions.mm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/CodeGenObjCXX/lambda-expressions.mm 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 -- 2.50.1