dblaikie created this revision.
dblaikie added a reviewer: aprantl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

(this would regress size without a corresponding LLVM change that avoids
putting other user defined types inside type units when they aren't in
their own type units - instead emitting declarations inside the type
unit and a definition in the primary CU)

Adrian - can you tell me whether the changes to the implicit modular debug info 
tests are OK? What does that feature use the 'identifier' for, if anything?


Repository:
  rC Clang

https://reviews.llvm.org/D61079

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/Modules/ExtDebugInfo.cpp
  test/Modules/ModuleDebugInfo.cpp


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")
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: 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<CXXRecordDecl>(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/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")
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: 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<CXXRecordDecl>(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?
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to