The shape is really just the number of methods in the vftable, since we don't support 16 bit far calls. All calls are near. Encode this number in the size of the artificial __vtbl_ptr_type DIDerivedType that we generate. For DWARF, this will be a normal pointer, but for codeview this will be a wide pointer that gets pattern matched into a VFTableShape record. Insert this type into the element list of all dynamic classes when emitting CodeView, so that the backend can emit the shape even if the vptr lives in a primary base class. Fixes PR28150 llvm-svn: 280255
41 lines
1.7 KiB
C++
41 lines
1.7 KiB
C++
// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
|
|
|
|
// Tests that certain miscellaneous features work in the MS ABI.
|
|
|
|
struct Foo {
|
|
virtual void f();
|
|
virtual void g();
|
|
virtual void h();
|
|
struct Nested {};
|
|
};
|
|
Foo f;
|
|
Foo::Nested n;
|
|
|
|
// CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
|
|
// CHECK-SAME: elements: ![[elements:[0-9]+]]
|
|
// CHECK-SAME: identifier: ".?AUFoo@@"
|
|
|
|
// CHECK: ![[elements]] = !{![[vshape:[0-9]+]], ![[vptr:[0-9]+]], ![[Nested:[0-9]+]], ![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]]}
|
|
|
|
// CHECK: ![[vshape]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", baseType: null, size: 96)
|
|
|
|
// CHECK: ![[vptr]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$Foo",
|
|
// CHECK-SAME: baseType: ![[vptr_ty:[0-9]+]],
|
|
|
|
// CHECK: ![[vptr_ty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[vshape]], size: 32
|
|
|
|
// CHECK: ![[Nested]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
|
|
// CHECK-SAME: identifier: ".?AUNested@Foo@@"
|
|
|
|
// CHECK: ![[f]] = !DISubprogram(name: "f",
|
|
// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
|
|
// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
|
|
|
|
// CHECK: ![[g]] = !DISubprogram(name: "g",
|
|
// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 1,
|
|
// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
|
|
|
|
// CHECK: ![[h]] = !DISubprogram(name: "h",
|
|
// CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
|
|
// CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
|