xref: /llvm-project/clang/test/CodeGen/debug-info-codeview-heapallocsite.c (revision c5de4dd1eab00df76c1a68c5f397304ceacb71f2)
1 // RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -emit-llvm %s -o - | FileCheck %s
2 
3 struct Foo;
4 struct Bar;
5 
6 __declspec(allocator) void *alloc_void(void);
7 __declspec(allocator) struct Foo *alloc_foo(void);
8 
call_alloc(void)9 void call_alloc(void) {
10   struct Foo *p = alloc_void();
11   struct Foo *w = alloc_foo();
12   struct Foo *q = (struct Foo*)alloc_void();
13   struct Foo *r = (struct Foo*)(struct Bar*)alloc_void();
14 }
15 
16 // CHECK-LABEL: define {{.*}}void @call_alloc
17 // CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]]
18 // CHECK: call ptr {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]]
19 // CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG2]]
20 // CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG3:!.*]]
21 
22 // CHECK: [[DBG2]] = !DICompositeType(tag: DW_TAG_structure_type,
23 // CHECK-SAME:                                 name: "Foo"
24 // CHECK: [[DBG3]] = !DICompositeType(tag: DW_TAG_structure_type,
25 // CHECK-SAME:                                 name: "Bar"
26 // CHECK: [[DBG1]] = !{}
27