Support for code generation of Objective-C top-level language constructs.
Implemented by David Chisnall!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51835 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 0a016c6..26a0cfb 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -65,11 +65,22 @@
for (unsigned i=0 ; i<OMD->param_size() ; i++) {
ParamTypes.push_back(ConvertType(OMD->getParamDecl(i)->getType()));
}
- CurFn =CGM.getObjCRuntime()->MethodPreamble(ConvertType(OMD->getResultType()),
- llvm::PointerType::getUnqual(llvm::Type::Int32Ty),
- ParamTypes.begin(),
- OMD->param_size(),
- OMD->isVariadic());
+ std::string CategoryName = "";
+ if (ObjCCategoryImplDecl *OCD =
+ dyn_cast<ObjCCategoryImplDecl>(OMD->getMethodContext())) {
+ CategoryName = OCD->getName();
+ }
+
+ CurFn =CGM.getObjCRuntime()->MethodPreamble(
+ OMD->getClassInterface()->getName(),
+ CategoryName,
+ OMD->getSelector().getName(),
+ ConvertType(OMD->getResultType()),
+ llvm::PointerType::getUnqual(llvm::Type::Int32Ty),
+ ParamTypes.begin(),
+ OMD->param_size(),
+ !OMD->isInstance(),
+ OMD->isVariadic());
llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn);
// Create a marker to make it easy to insert allocas into the entryblock