[cfe-commits] r50774 - /cfe/trunk/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Tue May 6 15:45:19 PDT 2008
Author: snaroff
Date: Tue May 6 17:45:19 2008
New Revision: 50774
URL: http://llvm.org/viewvc/llvm-project?rev=50774&view=rev
Log:
Fix <rdar://problem/5888515> clang ObjC rewriter: Use objc.h for declarations instead of putting them in the preamble?
Modified:
cfe/trunk/Driver/RewriteObjC.cpp
Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=50774&r1=50773&r2=50774&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Tue May 6 17:45:19 2008
@@ -306,30 +306,32 @@
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";
More information about the cfe-commits
mailing list