1 | // RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s |
2 | |
3 | // Tests virtual bases in the MS ABI. |
4 | |
5 | // CHECK: ![[NoPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NoPrimaryBase", |
6 | // CHECK-SAME: elements: ![[elements:[0-9]+]] |
7 | |
8 | // CHECK: ![[elements]] = !{![[NoPrimaryBase_base:[0-9]+]]} |
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) |
12 | |
13 | // CHECK: ![[HasVirtualMethod]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasVirtualMethod" |
14 | |
15 | // CHECK: ![[HasPrimaryBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasPrimaryBase", |
16 | // CHECK-SAME: elements: ![[elements:[0-9]+]] |
17 | |
18 | // CHECK: ![[elements]] = !{![[SecondaryVTable_base:[0-9]+]], ![[HasVirtualMethod_base:[0-9]+]], ![[vshape:[0-9]+]]} |
19 | |
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) |
22 | |
23 | // CHECK: ![[SecondaryVTable]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SecondaryVTable" |
24 | |
25 | // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]], extraData: i32 0) |
26 | |
27 | // CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase" |
28 | // CHECK-SAME: elements: ![[elements:[0-9]+]] |
29 | |
30 | // CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]] |
31 | // CHECK-NOT: DIFlagIndirectVirtualBase |
32 | // CHECK-SAME: ) |
33 | |
34 | // CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]] |
35 | // CHECK-SAME: flags: |
36 | // CHECK-SAME: DIFlagIndirectVirtualBase |
37 | |
38 | // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr", |
39 | // CHECK-SAME: elements: ![[elements:[0-9]+]] |
40 | |
41 | // CHECK: ![[elements]] = !{![[POD_base:[0-9]+]]} |
42 | |
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) |
45 | |
46 | // CHECK: ![[POD]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "POD" |
47 | |
48 | struct POD { int pod; }; |
49 | |
50 | struct DynamicNoVFPtr : virtual POD { }; |
51 | |
52 | DynamicNoVFPtr dynamic_no_vfptr; |
53 | |
54 | struct HasVirtualMethod { virtual void f(); }; |
55 | |
56 | struct NoPrimaryBase : virtual HasVirtualMethod { }; |
57 | |
58 | NoPrimaryBase no_primary_base; |
59 | |
60 | struct SecondaryVTable { virtual void g(); }; |
61 | |
62 | struct HasPrimaryBase : virtual SecondaryVTable, HasVirtualMethod { }; |
63 | |
64 | HasPrimaryBase has_primary_base; |
65 | |
66 | struct HasIndirectVirtualBase : public HasPrimaryBase {}; |
67 | |
68 | HasIndirectVirtualBase has_indirect_virtual_base; |
69 | |