[cfe-commits] r105113 - /cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Anders Carlsson andersca at mac.com
Sat May 29 13:49:49 PDT 2010


Author: andersca
Date: Sat May 29 15:49:49 2010
New Revision: 105113

URL: http://llvm.org/viewvc/llvm-project?rev=105113&view=rev
Log:
Make EmptySubobjectMap::CanPlaceBaseAtOffset take a BaseSubobjectInfo as well.

Modified:
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=105113&r1=105112&r2=105113&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Sat May 29 15:49:49 2010
@@ -103,8 +103,7 @@
   /// at the given offset.
   /// Returns false if placing the record will result in two components
   /// (direct or indirect) of the same type having the same offset.
-  bool CanPlaceBaseAtOffset(const CXXRecordDecl *RD, bool BaseIsVirtual,
-                            uint64_t Offset);
+  bool CanPlaceBaseAtOffset(const BaseSubobjectInfo *Info, uint64_t Offset);
 
   /// CanPlaceFieldAtOffset - Return whether a field can be placed at the given
   /// offset.
@@ -274,8 +273,7 @@
   }
 }
 
-bool EmptySubobjectMap::CanPlaceBaseAtOffset(const CXXRecordDecl *RD,
-                                             bool BaseIsVirtual,
+bool EmptySubobjectMap::CanPlaceBaseAtOffset(const BaseSubobjectInfo *Info,
                                              uint64_t Offset) {
   // If we know this class doesn't have any empty subobjects we don't need to
   // bother checking.
@@ -283,21 +281,12 @@
     return true;
 
   // FIXME: Re-enable this.
-#if 0
-  BaseSubobjectInfo *Info;
-
-  if (BaseIsVirtual)
-    Info = VirtualBaseInfo.lookup(RD);
-  else
-    Info = NonVirtualBaseInfo.lookup(RD);
-
   if (!CanPlaceBaseSubobjectAtOffset(Info, Offset))
     return false;
 
   // We are able to place the base at this offset. Make sure to update the
   // empty base subobject map.
   UpdateEmptyBaseSubobjects(Info, Offset);
-#endif
   return true;
 }
 
@@ -1032,7 +1021,7 @@
 
   // If we have an empty base class, try to place it at offset 0.
   if (Base->Class->isEmpty() &&
-      EmptySubobjects->CanPlaceBaseAtOffset(Base->Class, Base->IsVirtual, 0) &&
+      EmptySubobjects->CanPlaceBaseAtOffset(Base, 0) &&
       canPlaceRecordAtOffset(Base->Class, 0, /*CheckVBases=*/false)) {
     // We were able to place the class at offset 0.
     UpdateEmptyClassOffsets(Base->Class, 0, /*UpdateVBases=*/false);
@@ -1049,8 +1038,7 @@
 
   // Try to place the base.
   while (true) {
-    if (EmptySubobjects->CanPlaceBaseAtOffset(Base->Class, Base->IsVirtual, 
-                                              Offset) &&
+    if (EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset) &&
         canPlaceRecordAtOffset(Base->Class, Offset, /*CheckVBases=*/false))
       break;
 





More information about the cfe-commits mailing list