[cfe-commits] r52033 - in /cfe/trunk: include/clang/AST/RecordLayout.h lib/AST/ASTContext.cpp

Devang Patel dpatel at apple.com
Thu Jun 5 18:50:12 PDT 2008


Author: dpatel
Date: Thu Jun  5 20:50:12 2008
New Revision: 52033

URL: http://llvm.org/viewvc/llvm-project?rev=52033&view=rev
Log:
During interface layout, don't forget super class.

Modified:
    cfe/trunk/include/clang/AST/RecordLayout.h
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/include/clang/AST/RecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecordLayout.h?rev=52033&r1=52032&r2=52033&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/RecordLayout.h (original)
+++ cfe/trunk/include/clang/AST/RecordLayout.h Thu Jun  5 20:50:12 2008
@@ -33,7 +33,8 @@
   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;
   }

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=52033&r1=52032&r2=52033&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jun  5 20:50:12 2008
@@ -405,7 +405,15 @@
 
   // 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());





More information about the cfe-commits mailing list