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