xref: /aosp_15_r20/external/clang/test/CodeGenObjCXX/block-id.mm (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck %s
2*67e74705SXin Li
3*67e74705SXin Li// N.B.  This test verifies that two blocks which are otherwise
4*67e74705SXin Li//       indistinguishable receive distinct manglings.
5*67e74705SXin Li//       We had a bug where the first two blocks in the global block map could
6*67e74705SXin Li//       get the same unqualified-block mangling because the logic to handle
7*67e74705SXin Li//       block-ids believed it was handling Itanium-style discriminators.
8*67e74705SXin Li
9*67e74705SXin Litemplate<typename T>
10*67e74705SXin Liint tf() {
11*67e74705SXin Li    return T::value;
12*67e74705SXin Li}
13*67e74705SXin Liint i1 = ^int {
14*67e74705SXin Li    struct S { enum { value = 1 };};
15*67e74705SXin Li    // CHECK-DAG: @_Z2tfIZUb_E1SEiv
16*67e74705SXin Li    return tf<S>();
17*67e74705SXin Li}();
18*67e74705SXin Liint i2 = ^int(int p1) {
19*67e74705SXin Li    struct S { enum { value = 2 };};
20*67e74705SXin Li    // CHECK-DAG: @_Z2tfIZUb0_E1SEiv
21*67e74705SXin Li    return tf<S>() + p1;
22*67e74705SXin Li}(1);
23