summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 54b4e19c572..2b4eb5b5284 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -124,45 +124,31 @@ void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
// Emit allocs for param decls. Give the LLVM Argument nodes names.
llvm::Function::arg_iterator AI = CurFn->arg_begin();
+ // Name the struct return argument.
if (hasAggregateLLVMType(OMD->getResultType())) {
+ AI->setName("agg.result");
++AI;
}
+
// Add implicit parameters to the decl map.
- // TODO: Add something to AST to let the runtime specify the names and types
- // of these.
-
- llvm::Value *&SelfEntry = LocalDeclMap[OMD->getSelfDecl()];
- const llvm::Type *IPTy = AI->getType();
- llvm::Value *DeclPtr = new llvm::AllocaInst(IPTy, 0, AI->getName() +
- ".addr", AllocaInsertPt);
- // Store the initial value into the alloca.
- Builder.CreateStore(AI, DeclPtr);
- SelfEntry = DeclPtr;
+ EmitParmDecl(*OMD->getSelfDecl(), AI);
+ ++AI;
+
+ EmitParmDecl(*OMD->getCmdDecl(), AI);
++AI;
- llvm::Value *&CmdEntry = LocalDeclMap[OMD->getCmdDecl()];
- IPTy = AI->getType();
- DeclPtr = new llvm::AllocaInst(IPTy, 0, AI->getName() +
- ".addr", AllocaInsertPt);
- // Store the initial value into the alloca.
- Builder.CreateStore(AI, DeclPtr);
- CmdEntry = DeclPtr;
for (unsigned i = 0, e = OMD->getNumParams(); i != e; ++i, ++AI) {
assert(AI != CurFn->arg_end() && "Argument mismatch!");
EmitParmDecl(*OMD->getParamDecl(i), AI);
}
-
+ assert(AI == CurFn->arg_end() && "Argument mismatch");
+
GenerateFunction(OMD->getBody());
}
-llvm::Value *CodeGenFunction::LoadObjCSelf(void)
-{
- if (const ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(CurFuncDecl)) {
- ValueDecl *Decl = OMD->getSelfDecl();
- llvm::Value *SelfPtr = LocalDeclMap[&(*(Decl))];
- return Builder.CreateLoad(SelfPtr, "self");
- }
- return NULL;
+llvm::Value *CodeGenFunction::LoadObjCSelf(void) {
+ const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
+ return Builder.CreateLoad(LocalDeclMap[OMD->getSelfDecl()], "self");
}
CGObjCRuntime::~CGObjCRuntime() {}
OpenPOWER on IntegriCloud