Change CGObjCRuntime methods to take appropriate clang Decls.
 - This is in prep for implementation class support for the NeXT
   runtime, for which the existing methods don't provide enough
   information (and additionally make too many assumptions about how
   things should be emitted).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54824 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h
index a354aa1..83ca0e6 100644
--- a/lib/CodeGen/CGObjCRuntime.h
+++ b/lib/CodeGen/CGObjCRuntime.h
@@ -29,6 +29,9 @@
 }
 
 namespace clang {
+  class ObjCCategoryImplDecl;
+  class ObjCImplementationDecl;
+  class ObjCMethodDecl;
   class ObjCProtocolDecl;
   class Selector;
 
@@ -44,49 +47,37 @@
 
 public:
   virtual ~CGObjCRuntime();
+
+  /// Generate the function required to register all Objective-C components in
+  /// this compilation unit with the runtime library.
+  virtual llvm::Function *ModuleInitFunction() = 0;
+
+  /// Get a selector for the specified name and type values. The
+  /// return value should have the LLVM type for pointer-to
+  /// ASTContext::getObjCSelType().
+  virtual llvm::Value *GetSelector(BuilderType &Builder,
+                                   Selector Sel) = 0;
+
+  /// Generate a constant string object.
+  virtual llvm::Constant *GenerateConstantString(const std::string &String) = 0;
+
+  /// Generate a category.  A category contains a list of methods (and
+  /// accompanying metadata) and a list of protocols.
+  virtual void GenerateCategory(const ObjCCategoryImplDecl *OCD) = 0;
+
+  /// Generate a class stucture for this class.
+  virtual void GenerateClass(const ObjCImplementationDecl *OID) = 0;
   
-  /// Generate an Objective-C message send operation
+  /// Generate an Objective-C message send operation.
   virtual llvm::Value *GenerateMessageSend(BuilderType &Builder,
                                            const llvm::Type *ReturnTy,
                                            llvm::Value *Receiver,
                                            Selector Sel,
                                            llvm::Value** ArgV,
-                                           unsigned ArgC) =0;
+                                           unsigned ArgC) = 0;
 
-  /// Generate the function required to register all Objective-C components in
-  /// this compilation unit with the runtime library.
-  virtual llvm::Function *ModuleInitFunction() =0;
-
-  /// Get a selector for the specified name and type values
-  virtual llvm::Value *GetSelector(BuilderType &Builder,
-                                   Selector Sel) =0;
-
-  /// Generate a constant string object
-  virtual llvm::Constant *GenerateConstantString(const std::string &String) = 0;
-
-  /// Generate a category.  A category contains a list of methods (and
-  /// accompanying metadata) and a list of protocols.
-  virtual void GenerateCategory(const char *ClassName, const char *CategoryName,
-             const llvm::SmallVectorImpl<Selector>  &InstanceMethodSels,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &InstanceMethodTypes,
-             const llvm::SmallVectorImpl<Selector>  &ClassMethodSels,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &ClassMethodTypes,
-             const llvm::SmallVectorImpl<std::string> &Protocols) =0;
-
-  /// Generate a class stucture for this class.
-  virtual void GenerateClass(
-             const char *ClassName,
-             const char *SuperClassName,
-             const int instanceSize,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &IvarNames,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &IvarTypes,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &IvarOffsets,
-             const llvm::SmallVectorImpl<Selector>  &InstanceMethodSels,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &InstanceMethodTypes,
-             const llvm::SmallVectorImpl<Selector>  &ClassMethodSels,
-             const llvm::SmallVectorImpl<llvm::Constant *>  &ClassMethodTypes,
-             const llvm::SmallVectorImpl<std::string> &Protocols) =0;
-
+  /// Generate an Objective-C message send operation to the super
+  /// class.
   virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder<true> &Builder,
                                                 const llvm::Type *ReturnTy,
                                                 const char *SuperClassName,
@@ -98,27 +89,24 @@
   /// Emit the code to return the named protocol as an object, as in a
   /// @protocol expression.
   virtual llvm::Value *GenerateProtocolRef(llvm::IRBuilder<true> &Builder,
-                                           const ObjCProtocolDecl *PD) = 0;
+                                           const ObjCProtocolDecl *OPD) = 0;
 
   /// Generate the named protocol.  Protocols contain method metadata but no 
   /// implementations. 
-  virtual void GenerateProtocol(const ObjCProtocolDecl *PD) = 0;
+  virtual void GenerateProtocol(const ObjCProtocolDecl *OPD) = 0;
 
-  /// Generate a function preamble for a method with the specified types
-  virtual llvm::Function *MethodPreamble(
-                                         const std::string &ClassName,
-                                         const std::string &CategoryName,
-                                         const std::string &MethodName,
-                                         const llvm::Type *ReturnTy,
-                                         const llvm::Type *SelfTy,
-                                         const llvm::Type **ArgTy,
-                                         unsigned ArgC,
-                                         bool isClassMethod,
-                                         bool isVarArg) = 0;
+  /// Generate a function preamble for a method with the specified
+  /// types.  
+
+  // FIXME: Current this just generates the Function definition, but
+  // really this should also be generating the loads of the
+  // parameters, as the runtime should have full control over how
+  // parameters are passed.
+  virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD) = 0;
 
   /// Look up the class for the specified name
   virtual llvm::Value *LookupClass(BuilderType &Builder, 
-                                   llvm::Value *ClassName) =0;
+                                   llvm::Value *ClassName) = 0;
 
   /// If instance variable addresses are determined at runtime then this should
   /// return true, otherwise instance variables will be accessed directly from