diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index df49c70ec6..de89f0d961 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -129,7 +129,7 @@ void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) { DebugInfo = CGM.getDebugInfo(); StartObjCMethod(OMD, OMD->getClassInterface()); EmitStmt(OMD->getBody(getContext())); - FinishFunction(cast<CompoundStmt>(OMD->getBody(getContext()))->getRBracLoc()); + FinishFunction(OMD->getBodyRBrace(getContext())); } // FIXME: I wasn't sure about the synthesis approach. If we end up diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index c05ead5233..c74f8344cc 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -225,12 +225,13 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD, FProto->getArgType(i))); } - const CompoundStmt *S = FD->getBody(getContext()); + // FIXME: Support CXXTryStmt here, too. + if (const CompoundStmt *S = FD->getCompoundBody(getContext())) { + StartFunction(FD, FD->getResultType(), Fn, Args, S->getLBracLoc()); + EmitStmt(S); + FinishFunction(S->getRBracLoc()); + } - StartFunction(FD, FD->getResultType(), Fn, Args, S->getLBracLoc()); - EmitStmt(S); - FinishFunction(S->getRBracLoc()); - // Destroy the 'this' declaration. if (CXXThisDecl) CXXThisDecl->Destroy(getContext()); |