summaryrefslogtreecommitdiffstats
path: root/clang
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
commit1216b05d3d898c40fa3e674dc49ad22eb59b3db3 (patch)
treed37ae9f01876de0189f46f2d5cc2f20c97ce31f9 /clang
parent3ad519441fa2383349e3aefd4f9f72a231aaa866 (diff)
downloadbcm5719-llvm-1216b05d3d898c40fa3e674dc49ad22eb59b3db3.tar.gz
bcm5719-llvm-1216b05d3d898c40fa3e674dc49ad22eb59b3db3.zip
During interface layout, don't forget super class.
llvm-svn: 52033
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/RecordLayout.h3
-rw-r--r--clang/lib/AST/ASTContext.cpp10
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/include/clang/AST/RecordLayout.h b/clang/include/clang/AST/RecordLayout.h
index 82880abfcf5..b3ed16e1c0d 100644
--- a/clang/include/clang/AST/RecordLayout.h
+++ b/clang/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/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());
OpenPOWER on IntegriCloud