1 // RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
3 // Tests virtual bases in the MS ABI.
5 // CHECK: ![[NoPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NoPrimaryBase",
6 // CHECK-SAME: elements: ![[elements:[0-9]+]]
8 // CHECK: ![[elements]] = !{![[NoPrimaryBase_base:[0-9]+]]}
10 // CHECK: ![[NoPrimaryBase_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[NoPrimaryBase]],
11 // CHECK-SAME: baseType: ![[HasVirtualMethod:[0-9]+]], offset: 4, flags: DIFlagVirtual, extraData: i32 0)
13 // CHECK: ![[HasVirtualMethod]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasVirtualMethod"
15 // CHECK: ![[HasPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasPrimaryBase",
16 // CHECK-SAME: elements: ![[elements:[0-9]+]]
18 // CHECK: ![[elements]] = !{![[SecondaryVTable_base:[0-9]+]], ![[HasVirtualMethod_base:[0-9]+]], ![[vshape:[0-9]+]]}
20 // CHECK: ![[SecondaryVTable_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]],
21 // CHECK-SAME: baseType: ![[SecondaryVTable:[0-9]+]], offset: 4, flags: DIFlagVirtual, extraData: i32 4)
23 // CHECK: ![[SecondaryVTable]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SecondaryVTable"
25 // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]], extraData: i32 0)
27 // CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase"
28 // CHECK-SAME: elements: ![[elements:[0-9]+]]
30 // CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]]
31 // CHECK-NOT: DIFlagIndirectVirtualBase
34 // CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]]
36 // CHECK-SAME: DIFlagIndirectVirtualBase
38 // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr",
39 // CHECK-SAME: elements: ![[elements:[0-9]+]]
41 // CHECK: ![[elements]] = !{![[POD_base:[0-9]+]]}
43 // CHECK: ![[POD_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[DynamicNoVFPtr]],
44 // CHECK-SAME: baseType: ![[POD:[0-9]+]], offset: 4, flags: DIFlagVirtual, extraData: i32 0)
46 // CHECK: ![[POD]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "POD"
48 struct POD
{ int pod
; };
50 struct DynamicNoVFPtr
: virtual POD
{ };
52 DynamicNoVFPtr dynamic_no_vfptr
;
54 struct HasVirtualMethod
{ virtual void f(); };
56 struct NoPrimaryBase
: virtual HasVirtualMethod
{ };
58 NoPrimaryBase no_primary_base
;
60 struct SecondaryVTable
{ virtual void g(); };
62 struct HasPrimaryBase
: virtual SecondaryVTable
, HasVirtualMethod
{ };
64 HasPrimaryBase has_primary_base
;
66 struct HasIndirectVirtualBase
: public HasPrimaryBase
{};
68 HasIndirectVirtualBase has_indirect_virtual_base
;