diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-05-03 10:46:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-05-03 10:46:44 +0000 |
commit | 2bebbf0acee55404de4b8846713b64429e744e8f (patch) | |
tree | e89aab78b5f5928eab0486ddc87130dda25f6b31 /lib/CodeGen/CGObjCGNU.cpp | |
parent | b2dbbb99e12806eaaf53b7ccabc32f42b5719443 (diff) |
Compute Objective-C metadata size information from the record layout,
not the shadow structure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 218365e316..04b688f012 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -20,6 +20,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" +#include "clang/AST/RecordLayout.h" #include "clang/AST/StmtObjC.h" #include "llvm/Module.h" #include "llvm/ADT/SmallVector.h" @@ -742,18 +743,13 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { const_cast<ObjCInterfaceDecl *>(OID->getClassInterface()); std::string ClassName = ClassDecl->getNameAsString(); - // Get the size of instances. For runtimes that support late-bound instances - // this should probably be something different (size just of instance - // varaibles in this class, not superclasses?). - const llvm::Type *ObjTy = - CGObjCRuntime::GetConcreteClassStruct(CGM, ClassDecl); - int instanceSize = CGM.getTargetData().getTypePaddedSize(ObjTy); + // Get the size of instances. + int instanceSize = Context.getASTObjCImplementationLayout(OID).getSize() / 8; // Collect information about instance variables. llvm::SmallVector<llvm::Constant*, 16> IvarNames; llvm::SmallVector<llvm::Constant*, 16> IvarTypes; llvm::SmallVector<llvm::Constant*, 16> IvarOffsets; - ObjTy = llvm::PointerType::getUnqual(ObjTy); for (ObjCInterfaceDecl::ivar_iterator iter = ClassDecl->ivar_begin(), endIter = ClassDecl->ivar_end() ; iter != endIter ; iter++) { // Store the name |