]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/5888515> clang ObjC rewriter: Use objc.h for declarations instead...
authorSteve Naroff <snaroff@apple.com>
Tue, 6 May 2008 22:45:19 +0000 (22:45 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 6 May 2008 22:45:19 +0000 (22:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50774 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteObjC.cpp

index 66f98a41c57dc4d3883b95ff3ddd2398df7f27a3..e50ba66761434ba64c3f3033ec06ef8d1bee6dae 100644 (file)
@@ -306,30 +306,32 @@ void RewriteObjC::Initialize(ASTContext &context) {
   Preamble += "#define _REWRITER_typedef_Protocol\n";
   Preamble += "#endif\n";
   if (LangOpts.Microsoft) 
-    Preamble += "extern \"C\" {\n";
-  Preamble += "struct objc_object *objc_msgSend";
+    Preamble += "#define __OBJC_RW_EXTERN extern \"C\" __declspec(dllimport)\n";
+  else
+    Preamble += "#define __OBJC_RW_EXTERN extern\n";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_msgSend";
   Preamble += "(struct objc_object *, struct objc_selector *, ...);\n";
-  Preamble += "extern struct objc_object *objc_msgSendSuper";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_msgSendSuper";
   Preamble += "(struct objc_super *, struct objc_selector *, ...);\n";
-  Preamble += "extern struct objc_object *objc_msgSend_stret";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_msgSend_stret";
   Preamble += "(struct objc_object *, struct objc_selector *, ...);\n";
-  Preamble += "extern struct objc_object *objc_msgSendSuper_stret";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_msgSendSuper_stret";
   Preamble += "(struct objc_super *, struct objc_selector *, ...);\n";
-  Preamble += "extern struct objc_object *objc_msgSend_fpret";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_msgSend_fpret";
   Preamble += "(struct objc_object *, struct objc_selector *, ...);\n";
-  Preamble += "struct objc_object *objc_getClass";
+  Preamble += "__OBJC_RW_EXTERN objc_object *objc_getClass";
   Preamble += "(const char *);\n";
-  Preamble += "extern struct objc_object *objc_getMetaClass";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_getMetaClass";
   Preamble += "(const char *);\n";
-  Preamble += "extern void objc_exception_throw(struct objc_object *);\n";
-  Preamble += "extern void objc_exception_try_enter(void *);\n";
-  Preamble += "extern void objc_exception_try_exit(void *);\n";
-  Preamble += "extern struct objc_object *objc_exception_extract(void *);\n";
-  Preamble += "extern int objc_exception_match";
+  Preamble += "__OBJC_RW_EXTERN void objc_exception_throw(struct objc_object *);\n";
+  Preamble += "__OBJC_RW_EXTERN void objc_exception_try_enter(void *);\n";
+  Preamble += "__OBJC_RW_EXTERN void objc_exception_try_exit(void *);\n";
+  Preamble += "__OBJC_RW_EXTERN struct objc_object *objc_exception_extract(void *);\n";
+  Preamble += "__OBJC_RW_EXTERN int objc_exception_match";
   Preamble += "(struct objc_class *, struct objc_object *, ...);\n";
-  Preamble += "extern Protocol *objc_getProtocol(const char *);\n";
+  Preamble += "__OBJC_RW_EXTERN Protocol *objc_getProtocol(const char *);\n";
   if (LangOpts.Microsoft) 
-    Preamble += "} // end extern \"C\"\n";
+    Preamble += "#undef __OBJC_RW_EXTERN\n";
   Preamble += "#ifndef __FASTENUMERATIONSTATE\n";
   Preamble += "struct __objcFastEnumerationState {\n\t";
   Preamble += "unsigned long state;\n\t";