[PATCH] D23462: Emit debug info for abstract classes if they are imported from a DLL

Adrian McCarthy via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 13:28:17 PDT 2016


amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

With -debug-info-kind=limited, we omit debug info for abstract classes that live in other TUs.  This reduces duplicate type information.  When statically linked, the type information comes together.  But if your binary has a class derived from a base in a DLL, the base class info is not available to the debugger.

The decision is made in shouldOmitDefinition (CGDebugInfo.cpp).  Per a suggestion from rnk, I've tweaked the decision so that we do include definitions for classes marked as DLL imports.  This should be a relatively small number of classes, so we don't pay a large price for duplication of the type info, yet it should cover most cases on Windows.

Tested manually on Windows.  I'm working on a lit test, and I'll update this patch with it when it's finished.

https://reviews.llvm.org/D23462

Files:
  lib/CodeGen/CGDebugInfo.cpp

Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,8 @@
   if (!CXXDecl)
     return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+      !CXXDecl->hasAttr<DLLImportAttr>())
     return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23462.67891.patch
Type: text/x-patch
Size: 469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160812/2723cbcc/attachment.bin>


More information about the cfe-commits mailing list