r189022 - DebugInfo: emit the definition of types when construction vtables are required as these types may never end up emitting the full class data

David Blaikie dblaikie at gmail.com
Thu Aug 22 08:23:05 PDT 2013


Author: dblaikie
Date: Thu Aug 22 10:23:05 2013
New Revision: 189022

URL: http://llvm.org/viewvc/llvm-project?rev=189022&view=rev
Log:
DebugInfo: emit the definition of types when construction vtables are required as these types may never end up emitting the full class data

This might be able to be optimized further by only doing this in the
absence of a key function, but it doesn't look like GCC is doing that so
I'm not rushing to do it just yet.

Modified:
    cfe/trunk/lib/CodeGen/CGVTables.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-class.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=189022&r1=189021&r2=189022&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Thu Aug 22 10:23:05 2013
@@ -685,6 +685,9 @@ CodeGenVTables::GenerateConstructionVTab
                                       bool BaseIsVirtual, 
                                    llvm::GlobalVariable::LinkageTypes Linkage,
                                       VTableAddressPointsMapTy& AddressPoints) {
+  if (CGDebugInfo *DI = CGM.getModuleDebugInfo())
+    DI->completeClassData(Base.getBase());
+
   OwningPtr<VTableLayout> VTLayout(
     VTContext.createConstructionVTableLayout(Base.getBase(),
                                              Base.getBaseOffset(),
@@ -822,15 +825,15 @@ void CodeGenModule::EmitVTable(CXXRecord
 
 void 
 CodeGenVTables::GenerateClassData(const CXXRecordDecl *RD) {
+  if (CGDebugInfo *DI = CGM.getModuleDebugInfo())
+    DI->completeClassData(RD);
+
   if (VFTContext.isValid()) {
     // FIXME: This is a temporary solution to force generation of vftables in
     // Microsoft ABI. Remove when we thread VFTableContext through CodeGen.
     VFTContext->getVFPtrOffsets(RD);
   }
 
-  if (CGDebugInfo *DI = CGM.getModuleDebugInfo())
-    DI->completeClassData(RD);
-
   // First off, check whether we've already emitted the v-table and
   // associated stuff.
   llvm::GlobalVariable *VTable = GetAddrOfVTable(RD);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class.cpp?rev=189022&r1=189021&r2=189022&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-class.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class.cpp Thu Aug 22 10:23:05 2013
@@ -52,6 +52,11 @@ struct G {
   };
 };
 
+struct H {};
+struct I : virtual H {};
+struct J : I {};
+J j;
+
 struct A {
   int one;
   static const int HdrSize = 52;
@@ -103,6 +108,8 @@ int main(int argc, char **argv) {
 // CHECK: [[D_MEM]] = metadata !{metadata [[D_FUNC:![0-9]*]]}
 // CHECK: [[D_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
 
+// CHECK: ; [ DW_TAG_structure_type ] [I] {{.*}} [def]
+
 // CHECK: [[F_I_DEF:![0-9]*]] = {{.*}}, metadata [[F_I:![0-9]*]]} ; [ DW_TAG_variable ] [i]
 // CHECK: [[F_I]] = {{.*}} ; [ DW_TAG_member ] [i]
 // CHECK: [[F:![0-9]*]] = {{.*}} metadata [[F_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [F] {{.*}} [def]
@@ -117,5 +124,5 @@ int main(int argc, char **argv) {
 // CHECK: [[G_INNER_MEM]] = metadata !{metadata [[G_INNER_I:![0-9]*]]}
 // CHECK: [[G_INNER_I]] = {{.*}} ; [ DW_TAG_member ] [j] {{.*}} [from int]
 
-// CHECK: ![[EXCEPTLOC]] = metadata !{i32 79,
-// CHECK: ![[RETLOC]] = metadata !{i32 78,
+// CHECK: ![[EXCEPTLOC]] = metadata !{i32 84,
+// CHECK: ![[RETLOC]] = metadata !{i32 83,





More information about the cfe-commits mailing list