diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-20 21:09:58 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-20 21:09:58 +0000 |
commit | 452eac1fd71bc13c23eb034f5f66281ae27cf817 (patch) | |
tree | e3c075d52efc8e0fbca44784bdf0da26f9617805 | |
parent | ca7f5bdf8bf1e485abc802cac97f2c4c4172d638 (diff) |
more modern objective-c meta-data stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153127 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Rewrite/RewriteModernObjC.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index ead1ce6a5d..3c9c5ddbe4 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -5625,6 +5625,15 @@ static void Write_class_t(ASTContext *Context, std::string &Result, Result += VarName; Result += CDecl->getSuperClass()->getNameAsString(); Result += ";\n"; + + if (metaclass) { + if (RootClass->getImplementation()) + Result += "__declspec(dllexport) "; + Result += "extern struct _class_t "; + Result += VarName; + Result += RootClass->getNameAsString(); + Result += ";\n"; + } } Result += "\n__declspec(dllexport) struct _class_t "; Result += VarName; Result += CDecl->getNameAsString(); @@ -5640,7 +5649,7 @@ static void Write_class_t(ASTContext *Context, std::string &Result, Result += ",\n\t"; } else { - Result += "0, // "; Result += VarName; + Result += "0, // &"; Result += VarName; Result += CDecl->getNameAsString(); Result += ",\n\t"; Result += "0, // &OBJC_CLASS_$_"; Result += CDecl->getNameAsString(); @@ -5681,10 +5690,15 @@ static void Write_class_t(ASTContext *Context, std::string &Result, Result += "(void ) {\n"; Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString(); Result += ".isa = "; Result += "&OBJC_METACLASS_$_"; - Result += CDecl->getNameAsString(); Result += ";\n"; + Result += RootClass->getNameAsString(); Result += ";\n"; Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString(); - Result += ".superclass = "; Result += "&OBJC_METACLASS_$_"; + Result += ".superclass = "; + if (rootClass) + Result += "&OBJC_CLASS_$_"; + else + Result += "&OBJC_METACLASS_$_"; + Result += SuperClass->getNameAsString(); Result += ";\n"; Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString(); |