xref: /llvm-project/clang/test/CodeGen/attr-counted-by-debug-info.c (revision b1e97d60bd5b1d3f994345caa4012ea11c2a0f62)
1 // RUN: %clang -emit-llvm -DCOUNTED_BY -S -g %s -o - | FileCheck %s
2 // RUN: %clang -emit-llvm -S -g %s -o - | FileCheck %s
3 
4 #ifdef COUNTED_BY
5 #define __counted_by(member)    __attribute__((__counted_by__(member)))
6 #else
7 #define __counted_by(member)
8 #endif
9 
10 struct {
11   int num_counters;
12   long value[] __counted_by(num_counters);
13 } agent_send_response_port_num;
14 
15 // CHECK: !DICompositeType(tag: DW_TAG_array_type, baseType: ![[BT:.*]], elements: ![[ELEMENTS:.*]])
16 // CHECK: ![[BT]] = !DIBasicType(name: "long", size: {{.*}}, encoding: DW_ATE_signed)
17 // CHECK: ![[ELEMENTS]] = !{![[COUNT:.*]]}
18 // CHECK: ![[COUNT]] = !DISubrange(count: -1)