diff options
author | Mike Stump <mrs@apple.com> | 2009-12-04 23:26:17 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-12-04 23:26:17 +0000 |
commit | bee78dd31b5da3dda6d5e053df389df67e60564c (patch) | |
tree | c14c73ae84ad7ebd156d71b18c6095373f7e9217 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | e6d5445dc1bf69fdbf345ed09dec06c6346313aa (diff) | |
download | bcm5719-llvm-bee78dd31b5da3dda6d5e053df389df67e60564c.tar.gz bcm5719-llvm-bee78dd31b5da3dda6d5e053df389df67e60564c.zip |
Add support for function try blocks.
llvm-svn: 90622
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 88f02a9738c..d35c9621129 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -19,6 +19,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" +#include "clang/AST/StmtCXX.h" #include "llvm/Target/TargetData.h" using namespace clang; using namespace CodeGen; @@ -255,6 +256,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, FunctionArgList Args; + CurGD = GD; + OuterTryBlock = 0; if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) { if (MD->isInstance()) { // Create the implicit 'this' decl. @@ -286,7 +289,6 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, FProto->getArgType(i))); } - // FIXME: Support CXXTryStmt here, too. if (const CompoundStmt *S = FD->getCompoundBody()) { StartFunction(GD, FD->getResultType(), Fn, Args, S->getLBracLoc()); @@ -351,6 +353,13 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, } else { assert(false && "Cannot synthesize unknown implicit function"); } + } else if (const Stmt *S = FD->getBody()) { + if (const CXXTryStmt *TS = dyn_cast<CXXTryStmt>(S)) { + OuterTryBlock = TS; + StartFunction(GD, FD->getResultType(), Fn, Args, TS->getTryLoc()); + EmitStmt(TS); + FinishFunction(TS->getEndLoc()); + } } // Destroy the 'this' declaration. |