Clang Project

clang_source_code/test/CodeGenCXX/debug-info-ms-abi.cpp
1// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
2// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -gcodeview-ghash -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,GHASH
3
4// Tests that certain miscellaneous features work in the MS ABI.
5
6struct Foo {
7  virtual void f();
8  virtual void g();
9  virtual void h();
10  static void i(int, int);
11  struct Nested {};
12};
13Foo f;
14Foo::Nested n;
15
16// CHECK: ![[Nested:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
17// CHECK-SAME: identifier: ".?AUNested@Foo@@"
18
19// CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
20// CHECK-SAME: elements: ![[elements:[0-9]+]]
21// CHECK-SAME: identifier: ".?AUFoo@@"
22
23// CHECK: ![[elements]] = !{![[vshape:[0-9]+]], ![[vptr:[0-9]+]], ![[Nested]], ![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]], ![[i:[0-9]+]]}
24
25// CHECK: ![[vshape]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: null, size: 96)
26
27// CHECK: ![[vptr]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$Foo",
28// CHECK-SAME: baseType: ![[vptr_ty:[0-9]+]],
29
30// CHECK: ![[vptr_ty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[vshape]], size: 32
31
32// CHECK: ![[f]] = !DISubprogram(name: "f",
33// CHECK-SAME: containingType: ![[Foo]], virtualIndex: 0,
34// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
35// CHECK-SAME: spFlags: DISPFlagVirtual
36
37// CHECK: ![[g]] = !DISubprogram(name: "g",
38// CHECK-SAME: containingType: ![[Foo]], virtualIndex: 1,
39// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
40// CHECK-SAME: spFlags: DISPFlagVirtual
41
42// CHECK: ![[h]] = !DISubprogram(name: "h",
43// CHECK-SAME: containingType: ![[Foo]], virtualIndex: 2,
44// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
45// CHECK-SAME: spFlags: DISPFlagVirtual
46
47// CHECK: ![[i]] = !DISubprogram(name: "i",
48// CHECK-SAME: flags: DIFlagPrototyped | DIFlagStaticMember
49// CHECK-NEXT: ![[dummy:[0-9]+]] = !DISubroutineType(types: ![[Signature:[0-9]+]])
50// CHECK: ![[Signature]] = !{null, ![[BasicInt:[0-9]+]], ![[BasicInt]]}
51// CHECK: ![[BasicInt]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
52
53// CHECK: !{{[0-9]+}} = !{i32 2, !"CodeView", i32 1}
54// GHASH: !{{[0-9]+}} = !{i32 2, !"CodeViewGHash", i32 1}
55