[cfe-commits] r116535 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Thu Oct 14 15:59:24 PDT 2010


Author: dpatel
Date: Thu Oct 14 17:59:23 2010
New Revision: 116535

URL: http://llvm.org/viewvc/llvm-project?rev=116535&view=rev
Log:
Use root non-virtual primary base class, not just immediate primary base class, for AT_containing_type.
This is tested by virtfunc.exp in gdb testsuite.


Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=116535&r1=116534&r2=116535&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 14 17:59:23 2010
@@ -1018,9 +1018,19 @@
 
     // A class's primary base or the class itself contains the vtable.
     const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
-    if (const CXXRecordDecl *PBase = RL.getPrimaryBase())
+    if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) {
+      // Seek non virtual primary base root.
+      while (1) {
+        const ASTRecordLayout &BRL = CGM.getContext().getASTRecordLayout(PBase);
+        const CXXRecordDecl *PBT = BRL.getPrimaryBase();
+        if (PBT && !BRL.getPrimaryBaseWasVirtual())
+          PBase = PBT;
+        else 
+          break;
+      }
       ContainingType = 
         getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit);
+    }
     else if (CXXDecl->isDynamicClass()) 
       ContainingType = FwdDecl;
   }





More information about the cfe-commits mailing list