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/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 2e400f4..df3226d 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -103,33 +103,7 @@
/// Generate an Objective-C method. An Objective-C method is a C function with
/// its pointer, name, and types registered in the class struture.
void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
-
- llvm::SmallVector<const llvm::Type *, 16> ParamTypes;
- for (unsigned i=0 ; i<OMD->param_size() ; i++) {
- const llvm::Type *Ty = ConvertType(OMD->getParamDecl(i)->getType());
- if (Ty->isFirstClassType())
- ParamTypes.push_back(Ty);
- else
- ParamTypes.push_back(llvm::PointerType::getUnqual(Ty));
- }
- std::string CategoryName = "";
- if (ObjCCategoryImplDecl *OCD =
- dyn_cast<ObjCCategoryImplDecl>(OMD->getMethodContext())) {
- CategoryName = OCD->getName();
- }
- const llvm::Type *ReturnTy =
- CGM.getTypes().ConvertReturnType(OMD->getResultType());
- CurFn = CGM.getObjCRuntime().MethodPreamble(
- OMD->getClassInterface()->getName(),
- CategoryName,
- OMD->getSelector().getName(),
- ReturnTy,
- llvm::PointerType::getUnqual(
- llvm::Type::Int32Ty),
- ParamTypes.begin(),
- OMD->param_size(),
- !OMD->isInstance(),
- OMD->isVariadic());
+ CurFn = CGM.getObjCRuntime().GenerateMethod(OMD);
llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn);
// Create a marker to make it easy to insert allocas into the entryblock