]> granicus.if.org Git - clang/commitdiff
objc, objc rewriter. Fixes couple of bugs one
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 21 Dec 2011 19:48:07 +0000 (19:48 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 21 Dec 2011 19:48:07 +0000 (19:48 +0000)
because of recent refactoring and one in the
rewriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147070 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h
lib/Rewrite/RewriteObjC.cpp
test/Rewriter/rewrite-implementation.mm
test/Rewriter/rewrite-super-message.mm

index 8cc6e7374dd9fb35f92b4193849971f4f76ee9d4..a6f60f383ec4671c21badfaa10362f5559713561 100644 (file)
@@ -898,8 +898,9 @@ public:
   /// isImplicitInterfaceDecl - check that this is an implicitly declared
   /// ObjCInterfaceDecl node. This is for legacy objective-c @implementation
   /// declaration without an @interface declaration.
-  bool isImplicitInterfaceDecl() const { return isImplicit(); }
-  void setImplicitInterfaceDecl(bool val) { setImplicit(val); }
+  bool isImplicitInterfaceDecl() const { 
+    return hasDefinition() ? Data->Definition->isImplicit() : isImplicit(); 
+  }
 
   /// ClassImplementsProtocol - Checks that 'lProto' protocol
   /// has been implemented in IDecl class, its super class or categories (if
index 8fa1e833402c2256a19b6cde3a7a7c1391b01c78..57acba3de0bb0f62c52ef1ba2e69003f5bed3b20 100644 (file)
@@ -2478,7 +2478,7 @@ void RewriteObjC::SynthGetSuperClassFunctionDecl() {
                                                    false);
 }
 
-// SynthGetMetaClassFunctionDecl - id objc_getClass(const char *name);
+// SynthGetMetaClassFunctionDecl - id objc_getMetaClass(const char *name);
 void RewriteObjC::SynthGetMetaClassFunctionDecl() {
   IdentifierInfo *getClassIdent = &Context->Idents.get("objc_getMetaClass");
   SmallVector<QualType, 16> ArgTys;
@@ -2673,7 +2673,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
     // (Class)objc_getClass("CurrentClass")
     CastExpr *ArgExpr = NoTypeInfoCStyleCastExpr(Context,
                                              Context->getObjCClassType(),
-                                             CK_CPointerToObjCPointerCast, Cls);
+                                             CK_BitCast, Cls);
     ClsExprs.clear();
     ClsExprs.push_back(ArgExpr);
     Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl,
index c1d89a3c368775c758d6cee7ae416c5885b3daa6..afe0f9718a26345211e1d097b16071a80ba21888 100644 (file)
@@ -11,3 +11,6 @@
 @implementation b
 @end
 
+@interface NSArray @end
+@class NSArray;
+@implementation NSArray @end
index be0a963c55d4a7925e2fc8e3caaa7dc045c6032e..2def2808346f8efec4299589896b20cb8f0939be 100644 (file)
@@ -18,3 +18,21 @@ void *sel_registerName(const char *);
 @end
 
 // CHECK: call %struct.objc_class* @class_getSuperclass
+
+@class NSZone;
+
+@interface NSObject {
+}
+
++ (id)allocWithZone:(NSZone *)zone;
+@end
+
+
+@interface NSArray : NSObject
+@end
+
+@implementation NSArray
++ (id)allocWithZone:(NSZone *)zone {
+    return [super allocWithZone:zone];
+}
+@end