]> granicus.if.org Git - clang/commitdiff
Assert that the LLVM type has the same size as the RecordDecl size.
authorAnders Carlsson <andersca@mac.com>
Sat, 8 Aug 2009 18:01:57 +0000 (18:01 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 8 Aug 2009 18:01:57 +0000 (18:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78481 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGRecordLayoutBuilder.cpp

index 241a6e5395dbd93dc02145d604e4b90d3934a60c..a119d4f3a40cc43946b030ffe42c5d012ed86fa2 100644 (file)
@@ -301,6 +301,9 @@ CGRecordLayoutBuilder::ComputeLayout(CodeGenTypes &Types,
   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) {