]> granicus.if.org Git - clang/commitdiff
Path to synthesize 'instance' size field of _objc_class metadata.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 26 Oct 2007 23:09:28 +0000 (23:09 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 26 Oct 2007 23:09:28 +0000 (23:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43409 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteTest.cpp
clang.xcodeproj/project.pbxproj

index 6ccc23ae096fc04c53440a25300261135fb10c98..db2c1ee70b86724b88df8d84a17073d24925a9a6 100644 (file)
@@ -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();
index de41b4628d0c47ae944965792f26798c623eb63f..fe4cf8d85be8296188b8454e3723b21a50eb5906 100644 (file)
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
                        projectDirPath = "";