[cfe-commits] r126161 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
David Chisnall
csdavec at swan.ac.uk
Mon Feb 21 15:47:40 PST 2011
Author: theraven
Date: Mon Feb 21 17:47:40 2011
New Revision: 126161
URL: http://llvm.org/viewvc/llvm-project?rev=126161&view=rev
Log:
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)
Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=126161&r1=126160&r2=126161&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Feb 21 17:47:40 2011
@@ -949,7 +949,12 @@
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);
More information about the cfe-commits
mailing list