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

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


Author: kjdyck
Date: Tue Feb 15 19:43:15 2011
New Revision: 125638

URL: http://llvm.org/viewvc/llvm-project?rev=125638&view=rev
Log:
Convert NonVirtualAlignment to CharUnits. 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=125638&r1=125637&r2=125638&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Tue Feb 15 19:43:15 2011
@@ -578,7 +578,7 @@
   uint64_t DataSize;
 
   uint64_t NonVirtualSize;
-  unsigned NonVirtualAlignment;
+  CharUnits NonVirtualAlignment;
 
   /// PrimaryBase - the primary base class (if one exists) of the class
   /// we're laying out.
@@ -613,8 +613,8 @@
     : 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(8), PrimaryBase(0),
-      PrimaryBaseIsVirtual(false), FirstNearlyEmptyVBase(0) { }
+      DataSize(0), NonVirtualSize(0), NonVirtualAlignment(CharUnits::One()), 
+      PrimaryBase(0), PrimaryBaseIsVirtual(false), FirstNearlyEmptyVBase(0) { }
 
   void Layout(const RecordDecl *D);
   void Layout(const CXXRecordDecl *D);
@@ -1164,7 +1164,7 @@
   LayoutFields(RD);
 
   NonVirtualSize = Size;
-  NonVirtualAlignment = Alignment;
+  NonVirtualAlignment = Context.toCharUnitsFromBits(Alignment);
 
   // Lay out the virtual bases and add the primary virtual base offsets.
   LayoutVirtualBases(RD, RD);
@@ -1679,7 +1679,6 @@
       IsPODForThePurposeOfLayout ? Builder->Size : Builder->DataSize;
     uint64_t NonVirtualSize =
       IsPODForThePurposeOfLayout ? DataSize : Builder->NonVirtualSize;
-    uint64_t NonVirtualAlign = Builder->NonVirtualAlignment;
 
     CharUnits RecordSize = toCharUnitsFromBits(Builder->Size);
     NewEntry =
@@ -1689,7 +1688,7 @@
                                   Builder->FieldOffsets.data(),
                                   Builder->FieldOffsets.size(),
                                   toCharUnitsFromBits(NonVirtualSize),
-                                  toCharUnitsFromBits(NonVirtualAlign),
+                                  Builder->NonVirtualAlignment,
                                   EmptySubobjects.SizeOfLargestEmptySubobject,
                                   Builder->PrimaryBase,
                                   Builder->PrimaryBaseIsVirtual,





More information about the cfe-commits mailing list