DebugInfo: Prefer vtable homing over ctor homing.

Vtables will be emitted in fewer places than ctors (every ctor
references the vtable, so at worst it's the same places - but at best
the type has a non-inline key function and the vtable is emitted in one
place)

Pulling this fix out of 517bbc64db which
was reverted in 4821508d4d
This commit is contained in:
David Blaikie 2022-07-28 00:07:35 +00:00
parent 06da353748
commit 4e719e0f16
2 changed files with 12 additions and 1 deletions

View File

@ -3351,7 +3351,7 @@ void CGDebugInfo::completeTemplateDefinition(
}
void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) {
if (DebugKind <= codegenoptions::DebugLineTablesOnly)
if (DebugKind <= codegenoptions::DebugLineTablesOnly || D.isDynamicClass())
return;
completeClassData(&D);

View File

@ -77,3 +77,14 @@ void L() {
// Check that types are being added to retained types list.
// CHECK-DAG: !DICompileUnit{{.*}}retainedTypes: ![[RETAINED:[0-9]+]]
// CHECK-DAG: ![[RETAINED]] = {{.*}}![[C]]
struct VTableAndCtor {
virtual void f1();
VTableAndCtor();
};
VTableAndCtor::VTableAndCtor() {
}
// CHECK-DAG: !DICompositeType({{.*}}name: "VTableAndCtor", {{.*}}flags: DIFlagFwdDecl