]> granicus.if.org Git - clang/commitdiff
Round up the non-virtual size to the next char instead of rounding down.
authorKen Dyck <kd@kendyck.com>
Thu, 10 Mar 2011 01:53:59 +0000 (01:53 +0000)
committerKen Dyck <kd@kendyck.com>
Thu, 10 Mar 2011 01:53:59 +0000 (01:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127390 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp

index 3bdb6779754df818f791e75881bf2b233326a225..ecaa1f69620c1aab28856d99f26843cc075925c1 100644 (file)
@@ -1183,8 +1183,9 @@ void RecordLayoutBuilder::Layout(const CXXRecordDecl *RD) {
 
   LayoutFields(RD);
 
-  // FIXME: Size isn't always an exact multiple of the char width. Round up?
-  NonVirtualSize = Context.toCharUnitsFromBits(getSizeInBits());
+  NonVirtualSize = Context.toCharUnitsFromBits(
+        llvm::RoundUpToAlignment(getSizeInBits(), 
+                                 Context.Target.getCharAlign()));
   NonVirtualAlignment = Alignment;
 
   // Lay out the virtual bases and add the primary virtual base offsets.