[cfe-commits] r101814 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Daniel Dunbar
daniel at zuster.org
Mon Apr 19 13:44:47 PDT 2010
Author: ddunbar
Date: Mon Apr 19 15:44:47 2010
New Revision: 101814
URL: http://llvm.org/viewvc/llvm-project?rev=101814&view=rev
Log:
IRgen: Kill unused function and move the type match assert to after record dumping.
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=101814&r1=101813&r2=101814&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Mon Apr 19 15:44:47 2010
@@ -93,10 +93,6 @@
/// AppendField - Appends a field with the given offset and type.
void AppendField(uint64_t FieldOffsetInBytes, const llvm::Type *FieldTy);
- /// AppendPadding - Appends enough padding bytes so that the total struct
- /// size matches the alignment of the passed in type.
- void AppendPadding(uint64_t FieldOffsetInBytes, const llvm::Type *FieldTy);
-
/// AppendPadding - Appends enough padding bytes so that the total
/// struct size is a multiple of the field alignment.
void AppendPadding(uint64_t FieldOffsetInBytes, unsigned FieldAlignment);
@@ -481,12 +477,6 @@
BitsAvailableInLastField = 0;
}
-void
-CGRecordLayoutBuilder::AppendPadding(uint64_t FieldOffsetInBytes,
- const llvm::Type *FieldTy) {
- AppendPadding(FieldOffsetInBytes, getTypeAlignment(FieldTy));
-}
-
void CGRecordLayoutBuilder::AppendPadding(uint64_t FieldOffsetInBytes,
unsigned FieldAlignment) {
assert(NextFieldOffsetInBytes <= FieldOffsetInBytes &&
@@ -562,9 +552,6 @@
const llvm::Type *Ty = llvm::StructType::get(getLLVMContext(),
Builder.FieldTypes,
Builder.Packed);
- assert(getContext().getASTRecordLayout(D).getSize() / 8 ==
- getTargetData().getTypeAllocSize(Ty) &&
- "Type size mismatch!");
CGRecordLayout *RL =
new CGRecordLayout(Ty, Builder.ContainsPointerToDataMember);
@@ -577,6 +564,7 @@
for (unsigned i = 0, e = Builder.LLVMBitFields.size(); i != e; ++i)
RL->BitFields.insert(Builder.LLVMBitFields[i]);
+ // Dump the layout, if requested.
if (getContext().getLangOptions().DumpRecordLayouts) {
llvm::errs() << "\n*** Dumping Record Layout\n";
llvm::errs() << "Record: ";
@@ -585,6 +573,13 @@
RL->dump();
}
+ // Verify that the computed LLVM struct size matches the AST layout size.
+ assert(getContext().getASTRecordLayout(D).getSize() / 8 ==
+ getTargetData().getTypeAllocSize(Ty) &&
+ "Type size mismatch!");
+
+ // FIXME: We should verify the individual field offsets here as well.
+
return RL;
}
More information about the cfe-commits
mailing list