diff options
author | Devang Patel <dpatel@apple.com> | 2008-06-06 02:14:01 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-06-06 02:14:01 +0000 |
commit | 6a5a34c0e5587263df719c62030761cf59d27fe4 (patch) | |
tree | 97f5e139355ace888a0cc2874b665b229134495d /lib | |
parent | 80d310c6310084fb2bd9d37ecf3a32dac1148533 (diff) |
During interface layout, don't forget super class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ASTContext.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 4a1fb39bb6..d8e2c06fc0 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -405,10 +405,22 @@ 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(); + ASTRecordLayout *NewEntry = NULL; + unsigned FieldCount = D->ivar_size(); + if (ObjCInterfaceDecl *SD = D->getSuperClass()) { + FieldCount++; + const ASTRecordLayout &SL = getASTObjCInterfaceLayout(SD); + unsigned Alignment = SL.getAlignment(); + uint64_t Size = SL.getSize(); + NewEntry = new ASTRecordLayout(Size, Alignment); + NewEntry->InitializeLayout(FieldCount); + NewEntry->SetFieldOffset(0, 0); // Super class is at the beginning of the layout. + } else { + NewEntry = new ASTRecordLayout(); + NewEntry->InitializeLayout(FieldCount); + } Entry = NewEntry; - NewEntry->InitializeLayout(D->ivar_size()); bool IsPacked = D->getAttr<PackedAttr>(); if (const AlignedAttr *AA = D->getAttr<AlignedAttr>()) |