summaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/debug-info-ms-vbase.cpp
blob: 3de3a751cba1abed4938c546353ef5e8b521e4d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s

// Tests virtual bases in the MS ABI.

// CHECK: ![[NoPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NoPrimaryBase",
// CHECK-SAME: elements: ![[elements:[0-9]+]]

// CHECK: ![[elements]] = !{![[NoPrimaryBase_base:[0-9]+]]}

// CHECK: ![[NoPrimaryBase_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[NoPrimaryBase]],
// CHECK-SAME: baseType: ![[HasVirtualMethod:[0-9]+]], offset: 4, flags: DIFlagVirtual)

// CHECK: ![[HasVirtualMethod]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasVirtualMethod"

// CHECK: ![[HasPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasPrimaryBase",
// CHECK-SAME: elements: ![[elements:[0-9]+]]

// CHECK: ![[elements]] = !{![[SecondaryVTable_base:[0-9]+]], ![[HasVirtualMethod_base:[0-9]+]], ![[vshape:[0-9]+]]}

// CHECK: ![[SecondaryVTable_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]],
// CHECK-SAME: baseType: ![[SecondaryVTable:[0-9]+]], offset: 4, flags: DIFlagVirtual)

// CHECK: ![[SecondaryVTable]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SecondaryVTable"

// CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]])

// CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase"
// CHECK-SAME: elements: ![[elements:[0-9]+]]

// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]]
// CHECK-NOT: DIFlagIndirectVirtualBase
// CHECK-SAME: )

// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]]
// CHECK-SAME: flags:
// CHECK-SAME: DIFlagIndirectVirtualBase

// CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr",
// CHECK-SAME: elements: ![[elements:[0-9]+]]

// CHECK: ![[elements]] = !{![[POD_base:[0-9]+]]}

// CHECK: ![[POD_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[DynamicNoVFPtr]],
// CHECK-SAME: baseType: ![[POD:[0-9]+]], offset: 4, flags: DIFlagVirtual)

// CHECK: ![[POD]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "POD"

struct POD { int pod; };

struct DynamicNoVFPtr : virtual POD { };

DynamicNoVFPtr dynamic_no_vfptr;

struct HasVirtualMethod { virtual void f(); };

struct NoPrimaryBase : virtual HasVirtualMethod { };

NoPrimaryBase no_primary_base;

struct SecondaryVTable { virtual void g(); };

struct HasPrimaryBase : virtual SecondaryVTable, HasVirtualMethod { };

HasPrimaryBase has_primary_base;

struct HasIndirectVirtualBase : public HasPrimaryBase {};

HasIndirectVirtualBase has_indirect_virtual_base;