diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-01 14:13:53 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-06-01 14:13:53 +0000 |
commit | 20ff3108fcd2c3bd734dc79efc22ebaa090abd41 (patch) | |
tree | 022c249d29a7ebf64549cecac861eee67bdb350a /lib/CodeGen/CodeGenFunction.cpp | |
parent | 289d9f243d9074513368d27eef3b647f72a38324 (diff) |
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
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 0a016c6416..26a0cfbafb 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -65,11 +65,22 @@ void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) { 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 |