1 // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
2
3 void cb0(void);
4
5 // CHECK-DAG: !callback ![[cid0:[0-9]+]] void @no_args
6 __attribute__((callback(1))) void no_args(void (*callback)(void));
7
8 // CHECK-DAG: @args_1({{[^#]*#[0-9]+}} !callback ![[cid1:[0-9]+]]
args_1(void (* callback)(int,double),int a,double b)9 __attribute__((callback(1, 2, 3))) void args_1(void (*callback)(int, double), int a, double b) { no_args(cb0); }
10
11 // CHECK-DAG: !callback ![[cid2:[0-9]+]] void @args_2a
12 __attribute__((callback(2, 3, 3))) void args_2a(int a, void (*callback)(double, double), double b);
13 // CHECK-DAG: !callback ![[cid2]] void @args_2b
14 __attribute__((callback(callback, b, b))) void args_2b(int a, void (*callback)(double, double), double b);
15
16 // CHECK-DAG: void @args_3a({{[^#]*#[0-9]+}} !callback ![[cid3:[0-9]+]]
args_3a(int a,void (* callback)(double,double),double b)17 __attribute__((callback(2, -1, -1))) void args_3a(int a, void (*callback)(double, double), double b) { args_2a(a, callback, b); }
18 // CHECK-DAG: void @args_3b({{[^#]*#[0-9]+}} !callback ![[cid3]]
args_3b(int a,void (* callback)(double,double),double b)19 __attribute__((callback(callback, __, __))) void args_3b(int a, void (*callback)(double, double), double b) { args_2b(a, callback, b); }
20
21 // CHECK-DAG: ![[cid0]] = !{![[cid0b:[0-9]+]]}
22 // CHECK-DAG: ![[cid0b]] = !{i64 0, i1 false}
23 // CHECK-DAG: ![[cid1]] = !{![[cid1b:[0-9]+]]}
24 // CHECK-DAG: ![[cid1b]] = !{i64 0, i64 1, i64 2, i1 false}
25 // CHECK-DAG: ![[cid2]] = !{![[cid2b:[0-9]+]]}
26 // CHECK-DAG: ![[cid2b]] = !{i64 1, i64 2, i64 2, i1 false}
27 // CHECK-DAG: ![[cid3]] = !{![[cid3b:[0-9]+]]}
28 // CHECK-DAG: ![[cid3b]] = !{i64 1, i64 -1, i64 -1, i1 false}
29