1 // RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -fblocks -disable-llvm-passes -triple x86_64-apple-darwin10 -std=c++17 -emit-llvm -o - %s | FileCheck %s
3 typedef void (^blk_t)();
4 typedef void (*fnptr_t)();
8 @property fnptr_t fnptr;
12 blk_t operator+(blk_t lhs, T) { return lhs; }
15 fnptr_t operator+(fnptr_t lhs, T) { return lhs; }
17 // CHECK-LABEL: define{{.*}} void @_Z2t1P1X
19 // Check that we call lambda.operator blk_t(), and that we send that result to
22 // CHECK: [[CALL:%.*]] = call void ()* @"_ZZ2t1P1XENK3$_0cvU13block_pointerFvvEEv"
23 // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} void ()* [[CALL]])
26 // CHECK: [[CALL2:%.*]] = call void ()* @"_ZZ2t1P1XENK3$_1cvPFvvEEv"
27 // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} void ()* [[CALL2]])
31 // CHECK-LABEL: define{{.*}} void @_Z2t2P1X
33 // Test the case when the lambda isn't unique. (see OpaqueValueExpr::isUnique)
34 // FIXME: This asserts if the lambda isn't trivially copy/movable.
36 // [x setBlk: operator+([x blk], [] {})]
38 // CHECK: call void{{.*}}@objc_msgSend{{.*}}
39 // CHECK: [[PLUS:%.*]] = call void ()* @"_ZplIZ2t2P1XE3$_0EU13block_pointerFvvES4_T_"
40 // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} [[PLUS]])
43 // CHECK: call void{{.*}}@objc_msgSend{{.*}}
44 // CHECK: [[PLUS:%.*]] = call void ()* @"_ZplIZ2t2P1XE3$_1EPFvvES4_T_"
45 // CHECK: call void{{.*}}@objc_msgSend{{.*}}({{.*}} [[PLUS]])