Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -915,6 +915,11 @@ if (!needsTypeIdentifier(TD, CGM, TheCU)) return Identifier; + if (const auto *RD = dyn_cast(TD)) + if (RD->getDefinition()) + if (RD->isDynamicClass() && + CGM.getVTableLinkage(RD) == llvm::GlobalValue::ExternalLinkage) + return Identifier; // TODO: This is using the RTTI name. Is there a better way to get // a unique string for a type? Index: test/Modules/ExtDebugInfo.cpp =================================================================== --- test/Modules/ExtDebugInfo.cpp +++ test/Modules/ExtDebugInfo.cpp @@ -214,7 +214,7 @@ // CHECK-PCH: dwoId: 18446744073709551614 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A", -// CHECK-SAME: DIFlagFwdDecl, identifier: "_ZTS1A") +// CHECK-SAME: DIFlagFwdDecl) // There is a full definition of the type available in the module. // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual", Index: test/Modules/ModuleDebugInfo.cpp =================================================================== --- test/Modules/ModuleDebugInfo.cpp +++ test/Modules/ModuleDebugInfo.cpp @@ -119,8 +119,7 @@ // CHECK: ![[A:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "A", // CHECK-SAME: elements: -// CHECK-SAME: vtableHolder: ![[A]], -// CHECK-SAME: identifier: "_ZTS1A") +// CHECK-SAME: vtableHolder: ![[A]]) // CHECK: ![[DERIVED:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "Derived", // CHECK-SAME: identifier: "_ZTS7Derived")