Implement function-try-blocks. However, there's a very subtle bug that I can't track down.
llvm-svn: 70155
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index c05ead5..c74f834 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -225,12 +225,13 @@
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());