diff options
| author | David Blaikie <dblaikie@gmail.com> | 2022-07-28 00:07:35 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2022-07-28 00:07:35 +0000 |
| commit | 4e719e0f16933a8945a4e85db39fdad5afbede36 (patch) | |
| tree | c825bde6b4919800345f0b6b882ef83ba3408ea3 | |
| parent | 06da353748c967f57c357a97b95643bd9c172e71 (diff) | |
| download | llvm-4e719e0f16933a8945a4e85db39fdad5afbede36.zip llvm-4e719e0f16933a8945a4e85db39fdad5afbede36.tar.gz llvm-4e719e0f16933a8945a4e85db39fdad5afbede36.tar.bz2 | |
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 517bbc64dbe493644eff8d55fd9566435e930520 which
was reverted in 4821508d4db75a535d02b8938f81fac6de66cc26
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/debug-info-limited-ctor.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 94c4831..6821fc9 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -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); diff --git a/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp b/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp index 835e6d4..d17e3a1 100644 --- a/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp +++ b/clang/test/CodeGenCXX/debug-info-limited-ctor.cpp @@ -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 |
