During interface layout, don't forget super class.

llvm-svn: 52033
This commit is contained in:
Devang Patel 2008-06-06 01:50:12 +00:00
parent 3ad519441f
commit 1216b05d3d
2 changed files with 11 additions and 2 deletions

View File

@ -33,7 +33,8 @@ class ASTRecordLayout {
uint64_t *FieldOffsets;
friend class ASTContext;
ASTRecordLayout() : Size(0), Alignment(8) {}
ASTRecordLayout(uint64_t S = 0, unsigned A = 8)
: Size(S), Alignment(A) {}
~ASTRecordLayout() {
delete [] FieldOffsets;
}

View File

@ -405,7 +405,15 @@ ASTContext::getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) {
// Allocate and assign into ASTRecordLayouts here. The "Entry" reference can
// be invalidated (dangle) if the ASTRecordLayouts hashtable is inserted into.
ASTRecordLayout *NewEntry = new ASTRecordLayout();
unsigned Alignment = 8;
uint64_t Size = 0;
if (ObjCInterfaceDecl *SD = D->getSuperClass()) {
const ASTRecordLayout &SL = getASTObjCInterfaceLayout(SD);
Alignment = SL.getAlignment();
Size = SL.getSize();
}
ASTRecordLayout *NewEntry = new ASTRecordLayout(Size, Alignment);
Entry = NewEntry;
NewEntry->InitializeLayout(D->ivar_size());