From 1216b05d3d898c40fa3e674dc49ad22eb59b3db3 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 6 Jun 2008 01:50:12 +0000 Subject: During interface layout, don't forget super class. llvm-svn: 52033 --- clang/lib/AST/ASTContext.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'clang/lib/AST/ASTContext.cpp') diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4a1fb39bb60..8733a6b9894 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -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()); -- cgit v1.2.3