[cfe-commits] r90024 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Fri Nov 27 19:03:53 PST 2009


Author: andersca
Date: Fri Nov 27 21:03:52 2009
New Revision: 90024

URL: http://llvm.org/viewvc/llvm-project?rev=90024&view=rev
Log:
We always want to create a virtual function pointer entry if the path from the derived return value to the base overridden return value contains a virtual base class.

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

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=90024&r1=90023&r2=90024&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Fri Nov 27 21:03:52 2009
@@ -800,35 +800,13 @@
     return false;
   }
   
+  // If we found a virtual base we always want to require adjustment.
+  if (Paths.getDetectedVirtual())
+    return true;
+
   const CXXBasePath &Path = Paths.front();
   
-  size_t Start = 0, End = Path.size();
-  
-  // Check if we have a virtual base.
-  if (const RecordType *RT = Paths.getDetectedVirtual()) {
-    const CXXRecordDecl *VirtualBase = cast<CXXRecordDecl>(RT->getDecl());
-    assert(VirtualBase->isCanonicalDecl() && "Must have canonical decl!");
-    
-    // Check the virtual base class offset.
-    const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(DerivedDecl);
-
-    if (Layout.getVBaseClassOffset(VirtualBase) != 0) {
-      // This requires an adjustment.
-      return true;
-    }
-    
-    // Now ignore all the path elements up to the virtual base.
-    // FIXME: It would be nice if CXXBasePaths could return an index to the
-    // CXXElementSpecifier that corresponded to the virtual base.
-    for (; Start != End; ++Start) {
-      const CXXBasePathElement& Element = Path[Start];
-      
-      if (Element.Class == VirtualBase)
-        break;
-    }
-  }
-
-  for (; Start != End; ++Start) {
+  for (size_t Start = 0, End = Path.size(); Start != End; ++Start) {
     const CXXBasePathElement &Element = Path[Start];
 
     // Check the base class offset.





More information about the cfe-commits mailing list