From af05bb9073319d8381b71c4325188853fd4b8ed6 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 26 Aug 2008 08:29:31 +0000 Subject: Objective-C @synthesize support. - Only supports simple assignment and atomic semantics are ignored. - Not quite usable yet because the methods do not actually get added to the class metadata. - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain). - Rearrange CodeGenFunction so synthesis can reuse function prolog / epilog code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55365 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 11fde87302..909486a6d1 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -62,19 +62,15 @@ bool CodeGenFunction::hasAggregateLLVMType(QualType T) { !T->isVoidType() && !T->isVectorType() && !T->isFunctionType(); } -void CodeGenFunction::GenerateFunction(const Stmt *Body) { - // Emit the function body. - EmitStmt(Body); - +void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // Finish emission of indirect switches. EmitIndirectSwitches(); // Emit debug descriptor for function end. CGDebugInfo *DI = CGM.getDebugInfo(); if (DI) { - const CompoundStmt* s = dyn_cast(Body); - if (s && s->getRBracLoc().isValid()) { - DI->setLocation(s->getRBracLoc()); + if (EndLoc.isValid()) { + DI->setLocation(EndLoc); } DI->EmitRegionEnd(CurFn, Builder); } @@ -156,7 +152,15 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD, EmitParmDecl(*CurParam, V); } } - GenerateFunction(FD->getBody()); + + EmitStmt(FD->getBody()); + + const CompoundStmt *S = dyn_cast(FD->getBody()); + if (S) { + FinishFunction(S->getRBracLoc()); + } else { + FinishFunction(); + } } /// isDummyBlock - Return true if BB is an empty basic block -- cgit v1.2.3-18-g5258