aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-10-26 23:09:28 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-10-26 23:09:28 +0000
commit4d733d3288112667cfa3993424987b9ad9427f8f (patch)
tree2f041907975c52e52b1dabe487d5ecf3cde14536 /Driver/RewriteTest.cpp
parentbc26c58f3d44539c8172d88da44d46525afdaf29 (diff)
Path to synthesize 'instance' size field of _objc_class metadata.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 6ccc23ae09..db2c1ee70b 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -88,8 +88,6 @@ namespace {
std::string &Result);
void SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl,
std::string &Result);
- void RewriteObjcInternalStructs(ObjcImplementationDecl *IDecl,
- std::string &Result);
void SynthesizeIvarOffsetComputation(ObjcImplementationDecl *IDecl,
ObjcIvarDecl *ivar,
std::string &Result);
@@ -795,9 +793,9 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl,
? IDecl->getImplDeclNumIvars()
: (CDecl ? CDecl->getIntfDeclNumIvars() : 0);
+ SynthesizeObjcInternalStruct(CDecl, Result);
+
if (NumIvars > 0) {
- SynthesizeObjcInternalStruct(CDecl, Result);
-
static bool objc_ivar = false;
if (!objc_ivar) {
/* struct _objc_ivar {
@@ -971,8 +969,15 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl,
Result += "\"";
}
// 'info' field is initialized to CLS_CLASS(1) for class
- // TODO: instance_size is curently set to 0.
- Result += ", 0,1,0";
+ Result += ", 0,1";
+ if (!ObjcSynthesizedStructs.count(CDecl))
+ Result += ",0";
+ else {
+ // class has size. Must synthesize its size.
+ Result += ",sizeof(struct _interface_";
+ Result += CDecl->getName();
+ Result += ")";
+ }
if (NumIvars > 0) {
Result += ", &_OBJC_INSTANCE_VARIABLES_";
Result += CDecl->getName();