From: Fariborz Jahanian Date: Thu, 3 May 2012 20:23:37 +0000 (+0000) Subject: modern objc translation. objc_getClass() and objc_getMetaClass() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=502261a6731699f08716d928f254a6895e0cfb6e;p=clang modern objc translation. objc_getClass() and objc_getMetaClass() prototypes should both return `struct objc_class *`. // rdar://11375495 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156097 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index 05883d43df..3863d48374 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -5727,11 +5727,11 @@ void RewriteModernObjC::Initialize(ASTContext &context) { Preamble += "__OBJC_RW_DLLIMPORT void objc_msgSendSuper_stret(void);\n"; Preamble += "__OBJC_RW_DLLIMPORT void objc_msgSend_fpret(void);\n"; - Preamble += "__OBJC_RW_DLLIMPORT struct objc_object *objc_getClass"; + Preamble += "__OBJC_RW_DLLIMPORT struct objc_class *objc_getClass"; Preamble += "(const char *);\n"; Preamble += "__OBJC_RW_DLLIMPORT struct objc_class *class_getSuperclass"; Preamble += "(struct objc_class *);\n"; - Preamble += "__OBJC_RW_DLLIMPORT struct objc_object *objc_getMetaClass"; + Preamble += "__OBJC_RW_DLLIMPORT struct objc_class *objc_getMetaClass"; Preamble += "(const char *);\n"; Preamble += "__OBJC_RW_DLLIMPORT void objc_exception_throw( struct objc_object *);\n"; // @synchronized hooks. diff --git a/test/Rewriter/objc-modern-getclass-proto.mm b/test/Rewriter/objc-modern-getclass-proto.mm new file mode 100644 index 0000000000..9885657063 --- /dev/null +++ b/test/Rewriter/objc-modern-getclass-proto.mm @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -E %s -o %t.mm +// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %t.mm -o %t-rw.cpp +// rdar://11375495 + +@interface I @end +@implementation I @end + +// CHECK: __OBJC_RW_DLLIMPORT struct objc_class *objc_getClass(const char *); +// CHECK: __OBJC_RW_DLLIMPORT struct objc_class *objc_getMetaClass(const char *);