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

Anders Carlsson andersca at mac.com
Wed Sep 16 21:42:56 PDT 2009


Author: andersca
Date: Wed Sep 16 23:42:56 2009
New Revision: 82124

URL: http://llvm.org/viewvc/llvm-project?rev=82124&view=rev
Log:
Temporary band-aid for handling empty classes somewhat better.

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

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=82124&r1=82123&r2=82124&view=diff

==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Sep 16 23:42:56 2009
@@ -224,9 +224,11 @@
 void ASTRecordLayoutBuilder::LayoutBaseNonVirtually(const CXXRecordDecl *RD,
   bool IsVirtualBase) {
   const ASTRecordLayout &BaseInfo = Ctx.getASTRecordLayout(RD);
+  if (!Bases.empty()) {
     assert(BaseInfo.getDataSize() > 0 &&
            "FIXME: Handle empty classes.");
-
+  }
+  
   unsigned BaseAlign = BaseInfo.getNonVirtualAlign();
   uint64_t BaseSize = BaseInfo.getNonVirtualSize();
 

Modified: cfe/trunk/test/SemaCXX/class-layout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/class-layout.cpp?rev=82124&r1=82123&r2=82124&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/class-layout.cpp (original)
+++ cfe/trunk/test/SemaCXX/class-layout.cpp Wed Sep 16 23:42:56 2009
@@ -42,3 +42,8 @@
 };
 
 SA(5, sizeof(F) == 6);
+
+struct G { G(); };
+struct H : G { };
+
+SA(6, sizeof(H) == 1);





More information about the cfe-commits mailing list