[cfe-commits] r78481 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp

Anders Carlsson andersca at mac.com
Sat Aug 8 11:01:58 PDT 2009


Author: andersca
Date: Sat Aug  8 13:01:57 2009
New Revision: 78481

URL: http://llvm.org/viewvc/llvm-project?rev=78481&view=rev
Log:
Assert that the LLVM type has the same size as the RecordDecl size.

Modified:
    cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp

Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=78481&r1=78480&r2=78481&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Sat Aug  8 13:01:57 2009
@@ -301,6 +301,9 @@
   const llvm::Type *Ty = llvm::StructType::get(Types.getLLVMContext(),
                                                Builder.FieldTypes,
                                                Builder.Packed);
+  assert(Types.getContext().getASTRecordLayout(D).getSize() / 8 ==
+         Types.getTargetData().getTypeAllocSize(Ty) &&
+         "Type size mismatch!");
   
   // Add all the field numbers.
   for (unsigned i = 0, e = Builder.LLVMFields.size(); i != e; ++i) {





More information about the cfe-commits mailing list