[cfe-commits] r148068 - in /cfe/trunk: lib/AST/RecordLayoutBuilder.cpp test/SemaCXX/empty-class-layout.cpp

Eli Friedman eli.friedman at gmail.com
Thu Jan 12 15:27:03 PST 2012


Author: efriedma
Date: Thu Jan 12 17:27:03 2012
New Revision: 148068

URL: http://llvm.org/viewvc/llvm-project?rev=148068&view=rev
Log:
Revert r148056 while I investigate failures.


Modified:
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
    cfe/trunk/test/SemaCXX/empty-class-layout.cpp

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=148068&r1=148067&r2=148068&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Thu Jan 12 17:27:03 2012
@@ -1867,13 +1867,14 @@
                     Context.toBits(UnpackedFieldAlign), FieldPacked, D);
 
   // Reserve space for this field.
+  uint64_t FieldSizeInBits = Context.toBits(FieldSize);
   if (IsUnion)
-    setDataSize(std::max(getDataSize(), FieldSize));
+    setSize(std::max(getSizeInBits(), FieldSizeInBits));
   else
-    setDataSize(FieldOffset + FieldSize);
+    setSize(FieldOffset + FieldSize);
 
-  // Update the size.
-  setSize(std::max(getSize(), getDataSize()));
+  // Update the data size.
+  setDataSize(getSizeInBits());
 
   // Remember max struct/class alignment.
   UpdateAlignment(FieldAlign, UnpackedFieldAlign);

Modified: cfe/trunk/test/SemaCXX/empty-class-layout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/empty-class-layout.cpp?rev=148068&r1=148067&r2=148068&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/empty-class-layout.cpp (original)
+++ cfe/trunk/test/SemaCXX/empty-class-layout.cpp Thu Jan 12 17:27:03 2012
@@ -144,14 +144,3 @@
 SA(0, sizeof(B) == 16);
 
 }
-
-namespace Test7 {
-  // Make sure we reserve enough space for both bases; PR11745.
-  struct Empty { };
-  struct Base1 : Empty { };
-  struct Base2 : Empty { };
-  struct Test : Base1, Base2 {
-    char c;
-  };
-  SA(0, sizeof(Test) == 2);
-}





More information about the cfe-commits mailing list