diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-17 04:01:22 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-17 04:01:22 +0000 |
commit | d6c93d703541c992e06eb9a59a2d826a30da65b2 (patch) | |
tree | f201407533ab28dd4f3632975b6f852fbbedf617 | |
parent | d3a932a2980eef3c3ea2cd28f7946a185215d4e1 (diff) |
IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82117 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 57 | ||||
-rw-r--r-- | lib/CodeGen/CGObjCRuntime.h | 11 |
4 files changed, 48 insertions, 32 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index d437df484b..cadba328bf 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -92,8 +92,10 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) { isCategoryImpl, Receiver, isClassMessage, - Args); + Args, + E->getMethodDecl()); } + return Runtime.GenerateMessageSend(*this, E->getType(), E->getSelector(), Receiver, isClassMessage, Args, E->getMethodDecl()); diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 63caebfeec..c348123777 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -139,7 +139,8 @@ public: bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CallArgList &CallArgs); + const CallArgList &CallArgs, + const ObjCMethodDecl *Method); virtual llvm::Value *GetClass(CGBuilderTy &Builder, const ObjCInterfaceDecl *OID); virtual llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel); @@ -364,7 +365,8 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CallArgList &CallArgs) { + const CallArgList &CallArgs, + const ObjCMethodDecl *Method) { llvm::Value *cmd = GetSelector(CGF.Builder, Sel); CallArgList ActualArgs; @@ -1530,7 +1532,7 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD, std::string FunctionName = SymbolNameForMethod(ClassName, CategoryName, MethodName, isClassMethod); - llvm::Function *Method + llvm::Function *Method = llvm::Function::Create(MethodTy, llvm::GlobalValue::InternalLinkage, FunctionName, diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 7fd1198a88..a76e30223e 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -934,6 +934,7 @@ protected: QualType Arg0Ty, bool IsSuper, const CallArgList &CallArgs, + const ObjCMethodDecl *OMD, const ObjCCommonTypesHelper &ObjCTypes); public: @@ -1091,7 +1092,8 @@ public: bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CallArgList &CallArgs); + const CallArgList &CallArgs, + const ObjCMethodDecl *Method); virtual llvm::Value *GetClass(CGBuilderTy &Builder, const ObjCInterfaceDecl *ID); @@ -1313,7 +1315,8 @@ public: bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CallArgList &CallArgs); + const CallArgList &CallArgs, + const ObjCMethodDecl *Method); virtual llvm::Value *GetClass(CGBuilderTy &Builder, const ObjCInterfaceDecl *ID); @@ -1447,7 +1450,8 @@ CGObjCMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CodeGen::CallArgList &CallArgs) { + const CodeGen::CallArgList &CallArgs, + const ObjCMethodDecl *Method) { // Create and init a super structure; this is a (receiver, class) // pair we will pass to objc_msgSendSuper. llvm::Value *ObjCSuper = @@ -1489,7 +1493,7 @@ CGObjCMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, return EmitLegacyMessageSend(CGF, ResultType, EmitSelector(CGF.Builder, Sel), ObjCSuper, ObjCTypes.SuperPtrCTy, - true, CallArgs, ObjCTypes); + true, CallArgs, Method, ObjCTypes); } /// Generate code for a message send expression. @@ -1503,18 +1507,19 @@ CodeGen::RValue CGObjCMac::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, return EmitLegacyMessageSend(CGF, ResultType, EmitSelector(CGF.Builder, Sel), Receiver, CGF.getContext().getObjCIdType(), - false, CallArgs, ObjCTypes); + false, CallArgs, Method, ObjCTypes); } -CodeGen::RValue CGObjCCommonMac::EmitLegacyMessageSend( - CodeGen::CodeGenFunction &CGF, - QualType ResultType, - llvm::Value *Sel, - llvm::Value *Arg0, - QualType Arg0Ty, - bool IsSuper, - const CallArgList &CallArgs, - const ObjCCommonTypesHelper &ObjCTypes) { +CodeGen::RValue +CGObjCCommonMac::EmitLegacyMessageSend(CodeGen::CodeGenFunction &CGF, + QualType ResultType, + llvm::Value *Sel, + llvm::Value *Arg0, + QualType Arg0Ty, + bool IsSuper, + const CallArgList &CallArgs, + const ObjCMethodDecl *Method, + const ObjCCommonTypesHelper &ObjCTypes) { CallArgList ActualArgs; if (!IsSuper) Arg0 = CGF.Builder.CreateBitCast(Arg0, ObjCTypes.ObjectPtrTy, "tmp"); @@ -5080,18 +5085,18 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend( } /// Generate code for a message send expression in the nonfragile abi. -CodeGen::RValue CGObjCNonFragileABIMac::GenerateMessageSend( - CodeGen::CodeGenFunction &CGF, - QualType ResultType, - Selector Sel, - llvm::Value *Receiver, - bool IsClassMessage, - const CallArgList &CallArgs, - const ObjCMethodDecl *Method) { +CodeGen::RValue +CGObjCNonFragileABIMac::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, + QualType ResultType, + Selector Sel, + llvm::Value *Receiver, + bool IsClassMessage, + const CallArgList &CallArgs, + const ObjCMethodDecl *Method) { return LegacyDispatchedSelector(Sel) ? EmitLegacyMessageSend(CGF, ResultType, EmitSelector(CGF.Builder, Sel), Receiver, CGF.getContext().getObjCIdType(), - false, CallArgs, ObjCTypes) + false, CallArgs, Method, ObjCTypes) : EmitMessageSend(CGF, ResultType, Sel, Receiver, CGF.getContext().getObjCIdType(), false, CallArgs); @@ -5199,7 +5204,8 @@ CGObjCNonFragileABIMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, bool isCategoryImpl, llvm::Value *Receiver, bool IsClassMessage, - const CodeGen::CallArgList &CallArgs) { + const CodeGen::CallArgList &CallArgs, + const ObjCMethodDecl *Method) { // ... // Create and init a super structure; this is a (receiver, class) // pair we will pass to objc_msgSendSuper. @@ -5236,8 +5242,7 @@ CGObjCNonFragileABIMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, return (LegacyDispatchedSelector(Sel)) ? EmitLegacyMessageSend(CGF, ResultType,EmitSelector(CGF.Builder, Sel), ObjCSuper, ObjCTypes.SuperPtrCTy, - true, CallArgs, - ObjCTypes) + true, CallArgs, Method, ObjCTypes) : EmitMessageSend(CGF, ResultType, Sel, ObjCSuper, ObjCTypes.SuperPtrCTy, true, CallArgs); diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h index 8951ab6d32..a903ac3946 100644 --- a/lib/CodeGen/CGObjCRuntime.h +++ b/lib/CodeGen/CGObjCRuntime.h @@ -116,6 +116,9 @@ public: virtual void GenerateClass(const ObjCImplementationDecl *OID) = 0; /// Generate an Objective-C message send operation. + /// + /// \param Method - The method being called, this may be null if synthesizing + /// a property setter or getter. virtual CodeGen::RValue GenerateMessageSend(CodeGen::CodeGenFunction &CGF, QualType ResultType, @@ -123,11 +126,14 @@ public: llvm::Value *Receiver, bool IsClassMessage, const CallArgList &CallArgs, - const ObjCMethodDecl *Method=0) = 0; + const ObjCMethodDecl *Method = 0) = 0; /// Generate an Objective-C message send operation to the super /// class initiated in a method for Class and with the given Self /// object. + /// + /// \param Method - The method being called, this may be null if synthesizing + /// a property setter or getter. virtual CodeGen::RValue GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, QualType ResultType, @@ -136,7 +142,8 @@ public: bool isCategoryImpl, llvm::Value *Self, bool IsClassMessage, - const CallArgList &CallArgs) = 0; + const CallArgList &CallArgs, + const ObjCMethodDecl *Method = 0) = 0; /// Emit the code to return the named protocol as an object, as in a /// @protocol expression. |