Early patch to collect objective-c methods inserts them in
class object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41801 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index cabaae9..f0a072e 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -156,6 +156,8 @@
                              Declarator &D, ExprTy *BitfieldWidth);
   virtual void ParseRecordBody(SourceLocation RecLoc, DeclTy *TagDecl,
                                DeclTy **Fields, unsigned NumFields);
+  virtual void ObjcAddMethodsToClass(DeclTy *ClassDecl, 
+				     DeclTy **allMethods, unsigned allNum); 
   virtual DeclTy *ParseEnumConstant(Scope *S, DeclTy *EnumDecl,
                                     DeclTy *LastEnumConstant,
                                     SourceLocation IdLoc, IdentifierInfo *Id,
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 50cde4e..3315f38 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1140,6 +1140,30 @@
   Record->defineBody(&RecFields[0], RecFields.size());
 }
 
+void Sema::ObjcAddMethodsToClass(DeclTy *ClassDecl, 
+				 DeclTy **allMethods, unsigned allNum) { 
+  // FIXME: Add method insertion code here.
+#if 0
+  ObjcInterfaceDecl *Interface = cast<ObjcInterfaceDecl>(
+				   static_cast<Decl*>(ClassDecl));
+  llvm::SmallVector<ObjcMethodDecl*, 32> insMethods;
+  llvm::SmallVector<ObjcMethodDecl*, 16> clsMethods;
+
+  for (unsigned i = 0; i < allNum; i++ ) {
+    ObjcMethodDecl *Method = 
+      cast_or_null<ObjcMethodDecl>(static_cast<Decl*>(allMethods[i]));
+    if (!Method) continue;  // Already issued a diagnostic.
+    if (Method->isInstance())
+      insMethods.push_back(Method);
+    else
+      clsMethods.push_back(Method);
+  }
+  Interface->ObjcAddMethods(&insMethods[0], insMethods.size(), 
+			    &clsMethods[0], clsMethods.size());
+#endif
+  return;
+}
+
 Sema::DeclTy *Sema::ParseEnumConstant(Scope *S, DeclTy *theEnumDecl,
                                       DeclTy *lastEnumConst,
                                       SourceLocation IdLoc, IdentifierInfo *Id,