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

Ken Dyck kd at kendyck.com
Tue Feb 15 17:52:01 PST 2011


Author: kjdyck
Date: Tue Feb 15 19:52:01 2011
New Revision: 125639

URL: http://llvm.org/viewvc/llvm-project?rev=125639&view=rev
Log:
Convert NonVirtualSize to CharUnits from bits. No change in functionality
intended.

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=125639&r1=125638&r2=125639&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Tue Feb 15 19:52:01 2011
@@ -577,7 +577,7 @@
   /// DataSize - The data size of the record being laid out.
   uint64_t DataSize;
 
-  uint64_t NonVirtualSize;
+  CharUnits NonVirtualSize;
   CharUnits NonVirtualAlignment;
 
   /// PrimaryBase - the primary base class (if one exists) of the class
@@ -613,8 +613,9 @@
     : Context(Context), EmptySubobjects(EmptySubobjects), Size(0), Alignment(8),
       UnpackedAlignment(Alignment), Packed(false), IsUnion(false),
       IsMac68kAlign(false), UnfilledBitsInLastByte(0), MaxFieldAlignment(0),
-      DataSize(0), NonVirtualSize(0), NonVirtualAlignment(CharUnits::One()), 
-      PrimaryBase(0), PrimaryBaseIsVirtual(false), FirstNearlyEmptyVBase(0) { }
+      DataSize(0), NonVirtualSize(CharUnits::Zero()), 
+      NonVirtualAlignment(CharUnits::One()), PrimaryBase(0), 
+      PrimaryBaseIsVirtual(false), FirstNearlyEmptyVBase(0) { }
 
   void Layout(const RecordDecl *D);
   void Layout(const CXXRecordDecl *D);
@@ -1163,7 +1164,7 @@
 
   LayoutFields(RD);
 
-  NonVirtualSize = Size;
+  NonVirtualSize = Context.toCharUnitsFromBits(Size);
   NonVirtualAlignment = Context.toCharUnitsFromBits(Alignment);
 
   // Lay out the virtual bases and add the primary virtual base offsets.
@@ -1677,8 +1678,9 @@
     // FIXME: This should be done in FinalizeLayout.
     uint64_t DataSize =
       IsPODForThePurposeOfLayout ? Builder->Size : Builder->DataSize;
-    uint64_t NonVirtualSize =
-      IsPODForThePurposeOfLayout ? DataSize : Builder->NonVirtualSize;
+    CharUnits NonVirtualSize =
+      IsPODForThePurposeOfLayout ? 
+        toCharUnitsFromBits(DataSize) : Builder->NonVirtualSize;
 
     CharUnits RecordSize = toCharUnitsFromBits(Builder->Size);
     NewEntry =
@@ -1687,7 +1689,7 @@
                                   toCharUnitsFromBits(DataSize), 
                                   Builder->FieldOffsets.data(),
                                   Builder->FieldOffsets.size(),
-                                  toCharUnitsFromBits(NonVirtualSize),
+                                  NonVirtualSize,
                                   Builder->NonVirtualAlignment,
                                   EmptySubobjects.SizeOfLargestEmptySubobject,
                                   Builder->PrimaryBase,





More information about the cfe-commits mailing list