diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2011-02-21 23:47:40 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2011-02-21 23:47:40 +0000 |
commit | 05f3a507bb53ed2bd5573d551a26654a604187eb (patch) | |
tree | b833327e41c3f328d861d2ab8aa086291cfc7968 /lib/CodeGen/CGObjCGNU.cpp | |
parent | ddc83f9255834217f0559b09ff75a1c50b8ce457 (diff) |
The instance size of a metaclass should be the size of a class. This is not, in fact, 0, even for very small classes. (GNU runtime)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index d481e77926..8950f2131f 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -949,7 +949,12 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure( Elements.push_back(MakeConstantString(Name, ".class_name")); Elements.push_back(Zero); Elements.push_back(llvm::ConstantInt::get(LongTy, info)); - Elements.push_back(InstanceSize); + if (isMeta) { + llvm::TargetData td(&TheModule); + Elements.push_back(llvm::ConstantInt::get(LongTy, + td.getTypeSizeInBits(ClassTy)/8)); + } else + Elements.push_back(InstanceSize); Elements.push_back(IVars); Elements.push_back(Methods); Elements.push_back(NULLPtr); |