[cfe-commits] r82117 - in /cfe/trunk/lib/CodeGen: CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h

Daniel Dunbar daniel at zuster.org
Wed Sep 16 21:01:23 PDT 2009


Author: ddunbar
Date: Wed Sep 16 23:01:22 2009
New Revision: 82117

URL: http://llvm.org/viewvc/llvm-project?rev=82117&view=rev
Log:
IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.

Modified:
    cfe/trunk/lib/CodeGen/CGObjC.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CGObjCRuntime.h

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=82117&r1=82116&r2=82117&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Sep 16 23:01:22 2009
@@ -92,8 +92,10 @@
                                             isCategoryImpl,
                                             Receiver,
                                             isClassMessage,
-                                            Args);
+                                            Args,
+                                            E->getMethodDecl());
   }
+
   return Runtime.GenerateMessageSend(*this, E->getType(), E->getSelector(),
                                      Receiver, isClassMessage, Args,
                                      E->getMethodDecl());

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=82117&r1=82116&r2=82117&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Sep 16 23:01:22 2009
@@ -139,7 +139,8 @@
                            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 @@
                                     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 @@
   std::string FunctionName = SymbolNameForMethod(ClassName, CategoryName,
       MethodName, isClassMethod);
 
-  llvm::Function *Method 
+  llvm::Function *Method
     = llvm::Function::Create(MethodTy,
                              llvm::GlobalValue::InternalLinkage,
                              FunctionName,

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=82117&r1=82116&r2=82117&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Sep 16 23:01:22 2009
@@ -934,6 +934,7 @@
                                         QualType Arg0Ty,
                                         bool IsSuper,
                                         const CallArgList &CallArgs,
+                                        const ObjCMethodDecl *OMD,
                                         const ObjCCommonTypesHelper &ObjCTypes);
 
 public:
@@ -1091,7 +1092,8 @@
                            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 @@
                            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 @@
                                     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 @@
   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 @@
   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 @@
 }
 
 /// 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 @@
                                                  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 @@
   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);

Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=82117&r1=82116&r2=82117&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Wed Sep 16 23:01:22 2009
@@ -116,6 +116,9 @@
   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 @@
                       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 @@
                            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.





More information about the cfe-commits mailing list