[cfe-commits] r153512 - in /cfe/trunk: lib/Rewrite/RewriteModernObjC.cpp test/Rewriter/objc-modern-ivar-receiver-1.mm
Fariborz Jahanian
fjahanian at apple.com
Tue Mar 27 09:21:30 PDT 2012
Author: fjahanian
Date: Tue Mar 27 11:21:30 2012
New Revision: 153512
URL: http://llvm.org/viewvc/llvm-project?rev=153512&view=rev
Log:
Commit patch reverted in r153454 with the modified test
case that I forgot to check in.
Modified:
cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
cfe/trunk/test/Rewriter/objc-modern-ivar-receiver-1.mm
Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=153512&r1=153511&r2=153512&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Tue Mar 27 11:21:30 2012
@@ -3200,6 +3200,7 @@
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 &&
@@ -3209,7 +3210,7 @@
if (CDecl->getImplementation())
Result += "__declspec(dllexport) ";
}
- Result += "extern unsigned long ";
+ Result += "unsigned long ";
WriteInternalIvarName(CDecl, IvarDecl, Result);
Result += ";";
}
@@ -5420,7 +5421,7 @@
Result += "\tconst struct _prop_list_t *properties;\n";
Result += "};\n";
- Result += "__declspec(dllimport) extern struct objc_cache _objc_empty_cache;\n";
+ Result += "extern \"C\" __declspec(dllimport) struct objc_cache _objc_empty_cache;\n";
meta_data_declared = true;
}
@@ -5660,26 +5661,29 @@
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 += "extern struct _class_t OBJC_CLASS_$_";
+ Result += "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 += "extern struct _class_t ";
+ Result += "struct _class_t ";
Result += VarName;
Result += CDecl->getSuperClass()->getNameAsString();
Result += ";\n";
if (metaclass) {
+ Result += "extern \"C\" ";
if (RootClass->getImplementation())
Result += "__declspec(dllexport) ";
- Result += "extern struct _class_t ";
+ Result += "struct _class_t ";
Result += VarName;
Result += RootClass->getNameAsString();
Result += ";\n";
@@ -5790,10 +5794,11 @@
// 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 += "extern struct _class_t ";
+ Result += "struct _class_t ";
Result += "OBJC_CLASS_$_"; Result += ClassName;
Result += ";\n";
Modified: cfe/trunk/test/Rewriter/objc-modern-ivar-receiver-1.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/objc-modern-ivar-receiver-1.mm?rev=153512&r1=153511&r2=153512&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/objc-modern-ivar-receiver-1.mm (original)
+++ cfe/trunk/test/Rewriter/objc-modern-ivar-receiver-1.mm Tue Mar 27 11:21:30 2012
@@ -28,4 +28,4 @@
// CHECK: id obj = (*(id *)((char *)newInv + OBJC_IVAR_$_NSInvocation$_container));
// rdar://11076938
// CHECK: struct _class_t *superclass;
-// CHECK: __declspec(dllimport) extern struct objc_cache _objc_empty_cache;
+// CHECK: extern "C" __declspec(dllimport) struct objc_cache _objc_empty_cache;
More information about the cfe-commits
mailing list