diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-21 19:48:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-21 19:48:07 +0000 |
commit | a4b2a86353ef12c7abd4aaffbbfb4ab22d79eea0 (patch) | |
tree | 80662b45636394bd8ff5e6ca70b13d351863d428 | |
parent | c80a26438675a986de1ab69af89e6522ec78e211 (diff) | |
download | bcm5719-llvm-a4b2a86353ef12c7abd4aaffbbfb4ab22d79eea0.tar.gz bcm5719-llvm-a4b2a86353ef12c7abd4aaffbbfb4ab22d79eea0.zip |
objc, objc rewriter. Fixes couple of bugs one
because of recent refactoring and one in the
rewriter.
llvm-svn: 147070
-rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 5 | ||||
-rw-r--r-- | clang/lib/Rewrite/RewriteObjC.cpp | 4 | ||||
-rw-r--r-- | clang/test/Rewriter/rewrite-implementation.mm | 3 | ||||
-rw-r--r-- | clang/test/Rewriter/rewrite-super-message.mm | 18 |
4 files changed, 26 insertions, 4 deletions
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 8cc6e7374dd..a6f60f383ec 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -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 diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index 8fa1e833402..57acba3de0b 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -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, diff --git a/clang/test/Rewriter/rewrite-implementation.mm b/clang/test/Rewriter/rewrite-implementation.mm index c1d89a3c368..afe0f9718a2 100644 --- a/clang/test/Rewriter/rewrite-implementation.mm +++ b/clang/test/Rewriter/rewrite-implementation.mm @@ -11,3 +11,6 @@ @implementation b @end +@interface NSArray @end +@class NSArray; +@implementation NSArray @end diff --git a/clang/test/Rewriter/rewrite-super-message.mm b/clang/test/Rewriter/rewrite-super-message.mm index be0a963c55d..2def2808346 100644 --- a/clang/test/Rewriter/rewrite-super-message.mm +++ b/clang/test/Rewriter/rewrite-super-message.mm @@ -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 |