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 | aff9fcaa02b739853318987bbbed9938b176f288 (patch) | |
| tree | d3d34408a25c4c9f18d17a582adcbd07da038f1f | |
| parent | a96f56fba8879d785216665d951abb7d753a1444 (diff) | |
| download | bcm5719-llvm-aff9fcaa02b739853318987bbbed9938b176f288.tar.gz bcm5719-llvm-aff9fcaa02b739853318987bbbed9938b176f288.zip  | |
IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
llvm-svn: 82117
| -rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 57 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGObjCRuntime.h | 11 | 
4 files changed, 48 insertions, 32 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index d437df484be..cadba328bf1 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/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/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 63caebfeec5..c3481237777 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/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/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 7fd1198a880..a76e30223e8 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/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/clang/lib/CodeGen/CGObjCRuntime.h b/clang/lib/CodeGen/CGObjCRuntime.h index 8951ab6d32b..a903ac39464 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.h +++ b/clang/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.  | 

