aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-06-06 01:50:12 +0000
committerDevang Patel <dpatel@apple.com>2008-06-06 01:50:12 +0000
commit0e8eda7a4da933b04eac89d2856abf728188bf13 (patch)
treeb245697054bd01c150b8c2ff29451a4a01031596
parentc68ecb5724b383ac4c3945311c68cd7f2621a344 (diff)
During interface layout, don't forget super class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52033 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/RecordLayout.h3
-rw-r--r--lib/AST/ASTContext.cpp10
2 files changed, 11 insertions, 2 deletions
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h
index 82880abfcf..b3ed16e1c0 100644
--- a/include/clang/AST/RecordLayout.h
+++ b/include/clang/AST/RecordLayout.h
@@ -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;
}
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 4a1fb39bb6..8733a6b989 100644
--- a/lib/AST/ASTContext.cpp
+++ b/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());