r258251 - Module Debugging: Don't emit external type references to anonymous types.

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 15:42:53 PST 2016


Author: adrian
Date: Tue Jan 19 17:42:53 2016
New Revision: 258251

URL: http://llvm.org/viewvc/llvm-project?rev=258251&view=rev
Log:
Module Debugging: Don't emit external type references to anonymous types.
Even if they exist in the module, they can't be matched with the forward
declaration in the object file.
<rdar://problem/24199640>

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/Modules/ExtDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 19 17:42:53 2016
@@ -1536,8 +1536,9 @@ static bool shouldOmitDefinition(CodeGen
                                  const RecordDecl *RD,
                                  const LangOptions &LangOpts) {
   // Does the type exist in an imported clang module?
-  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition())
-      return true;
+  if (DebugTypeExtRefs && RD->isFromASTFile() && RD->getDefinition() &&
+      RD->isExternallyVisible())
+    return true;
 
   if (DebugKind > CodeGenOptions::LimitedDebugInfo)
     return false;

Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258251&r1=258250&r2=258251&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)
+++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Tue Jan 19 17:42:53 2016
@@ -84,4 +84,13 @@ void foo() {
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]],
 // CHECK-SAME:             line: 16
 
+// CHECK: !DIGlobalVariable(name: "GlobalUnion",
+// CHECK-SAME:              type: ![[GLOBAL_UNION:[0-9]+]]
+// CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
+// CHECK-SAME:                elements: !{{[0-9]+}})
+// CHECK: !DIGlobalVariable(name: "GlobalStruct",
+// CHECK-SAME:              type: ![[GLOBAL_STRUCT:[0-9]+]]
+// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
+// CHECK-SAME:                elements: !{{[0-9]+}})
+
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)




More information about the cfe-commits mailing list