From: Daniel Dunbar Date: Mon, 26 Mar 2012 18:48:59 +0000 (+0000) Subject: Revert r153443 "objective-c modern translator: extern "C" exported", it fails in... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad11f1c66831cb1a6fc9223493afbb16e34926b1;p=clang Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153454 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index c4f721f8c2..c0f7ea4d53 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -3200,7 +3200,6 @@ void RewriteModernObjC::RewriteIvarOffsetSymbols(ObjCInterfaceDecl *CDecl, e = Ivars.end(); i != e; i++) { ObjCIvarDecl *IvarDecl = (*i); Result += "\n"; - Result += "extern \"C\" "; if (LangOpts.MicrosoftExt) Result += "__declspec(allocate(\".objc_ivar$B\")) "; if (LangOpts.MicrosoftExt && @@ -3210,7 +3209,7 @@ void RewriteModernObjC::RewriteIvarOffsetSymbols(ObjCInterfaceDecl *CDecl, if (CDecl->getImplementation()) Result += "__declspec(dllexport) "; } - Result += "unsigned long "; + Result += "extern unsigned long "; WriteInternalIvarName(CDecl, IvarDecl, Result); Result += ";"; } @@ -5421,7 +5420,7 @@ static void WriteModernMetadataDeclarations(ASTContext *Context, std::string &Re Result += "\tconst struct _prop_list_t *properties;\n"; Result += "};\n"; - Result += "extern \"C\" __declspec(dllimport) struct objc_cache _objc_empty_cache;\n"; + Result += "__declspec(dllimport) extern struct objc_cache _objc_empty_cache;\n"; meta_data_declared = true; } @@ -5661,29 +5660,26 @@ static void Write_class_t(ASTContext *Context, std::string &Result, if (metaclass && rootClass) { // Need to handle a case of use of forward declaration. Result += "\n"; - Result += "extern \"C\" "; if (CDecl->getImplementation()) Result += "__declspec(dllexport) "; - Result += "struct _class_t OBJC_CLASS_$_"; + 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 (!rootClass) { Result += "\n"; - Result += "extern \"C\" "; if (CDecl->getSuperClass()->getImplementation()) Result += "__declspec(dllexport) "; - Result += "struct _class_t "; + Result += "extern struct _class_t "; Result += VarName; Result += CDecl->getSuperClass()->getNameAsString(); Result += ";\n"; if (metaclass) { - Result += "extern \"C\" "; if (RootClass->getImplementation()) Result += "__declspec(dllexport) "; - Result += "struct _class_t "; + Result += "extern struct _class_t "; Result += VarName; Result += RootClass->getNameAsString(); Result += ";\n"; @@ -5794,11 +5790,10 @@ static void Write_category_t(RewriteModernObjC &RewriteObj, ASTContext *Context, // must declare an extern class object in case this class is not implemented // in this TU. Result += "\n"; - Result += "extern \"C\" "; if (ClassDecl->getImplementation()) Result += "__declspec(dllexport) "; - Result += "struct _class_t "; + Result += "extern struct _class_t "; Result += "OBJC_CLASS_$_"; Result += ClassName; Result += ";\n";