]> granicus.if.org Git - clang/commitdiff
objective-c modern rewriter: add __declspec(dllexport) to forward
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 10 Mar 2012 18:25:06 +0000 (18:25 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 10 Mar 2012 18:25:06 +0000 (18:25 +0000)
declaration of class metadata when they are defined later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152500 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/RewriteModernObjC.cpp

index 87d49fd08f060832f4a69d12b2f28c88ff0631af..269249d65ed5cc135bef19e013cdbd4bf9aa06a0 100644 (file)
@@ -5682,13 +5682,20 @@ static void Write_class_t(ASTContext *Context, std::string &Result,
   
   if (metadata && !CDecl->getSuperClass()) {
     // Need to handle a case of use of forward declaration.
-    Result += "\nextern struct _class_t OBJC_CLASS_$_";
+    Result += "\n";
+    if (CDecl->getImplementation())
+      Result += "__declspec(dllexport) ";
+    Result += "extern struct _class_t OBJC_CLASS_$_";
     Result += CDecl->getNameAsString();
     Result += ";\n";
   }
   // Also, for possibility of 'super' metadata class not having been defined yet.
   if (CDecl->getSuperClass()) {
-    Result += "\nextern struct _class_t "; Result += VarName;
+    Result += "\n";
+    if (CDecl->getSuperClass()->getImplementation())
+      Result += "__declspec(dllexport) ";
+    Result += "extern struct _class_t "; 
+    Result += VarName;
     Result += CDecl->getSuperClass()->getNameAsString();
     Result += ";\n";
   }