summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-05-06 22:45:19 +0000
committerSteve Naroff <snaroff@apple.com>2008-05-06 22:45:19 +0000
commitac81a5aad54e2d0c95a4fa436765006b671283dd (patch)
tree9abb69846e5a2584db6ca359a4f285a177faafe8 /clang
parentaa63ca92727582e635c7b6a484e828c714fc08fb (diff)
downloadbcm5719-llvm-ac81a5aad54e2d0c95a4fa436765006b671283dd.tar.gz
bcm5719-llvm-ac81a5aad54e2d0c95a4fa436765006b671283dd.zip
Fix <rdar://problem/5888515> clang ObjC rewriter: Use objc.h for declarations instead of putting them in the preamble?
llvm-svn: 50774
Diffstat (limited to 'clang')
-rw-r--r--clang/Driver/RewriteObjC.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/clang/Driver/RewriteObjC.cpp b/clang/Driver/RewriteObjC.cpp
index 66f98a41c57..e50ba667614 100644
--- a/clang/Driver/RewriteObjC.cpp
+++ b/clang/Driver/RewriteObjC.cpp
@@ -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";
OpenPOWER on IntegriCloud