diff options
author | John McCall <rjmccall@apple.com> | 2010-07-07 06:56:46 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-07 06:56:46 +0000 |
commit | 59a7000a79118e4c140885ccbb2ac6a686a73092 (patch) | |
tree | 803331196f70138a85888e168a5ce1721c6c425b /lib/CodeGen/CGClass.cpp | |
parent | 8b5dec3002bd3e17061a8bf1fc35ba82912ec768 (diff) |
Teach function-try-blocks on constructors and destructors to implicitly
rethrow. Fixes rdar://problem/7696603
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index a69a3f9566..df5ea18c0c 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -606,11 +606,9 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) { // Enter the function-try-block before the constructor prologue if // applicable. - CXXTryStmtInfo TryInfo; bool IsTryBody = (Body && isa<CXXTryStmt>(Body)); - if (IsTryBody) - TryInfo = EnterCXXTryStmt(*cast<CXXTryStmt>(Body)); + EnterCXXTryStmt(*cast<CXXTryStmt>(Body), true); EHScopeStack::stable_iterator CleanupDepth = EHStack.stable_begin(); @@ -631,7 +629,7 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) { PopCleanupBlocks(CleanupDepth); if (IsTryBody) - ExitCXXTryStmt(*cast<CXXTryStmt>(Body), TryInfo); + ExitCXXTryStmt(*cast<CXXTryStmt>(Body), true); } /// EmitCtorPrologue - This routine generates necessary code to initialize @@ -671,11 +669,10 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { // anything else --- unless we're in a deleting destructor, in which // case we're just going to call the complete destructor and then // call operator delete() on the way out. - CXXTryStmtInfo TryInfo; bool isTryBody = (DtorType != Dtor_Deleting && Body && isa<CXXTryStmt>(Body)); if (isTryBody) - TryInfo = EnterCXXTryStmt(*cast<CXXTryStmt>(Body)); + EnterCXXTryStmt(*cast<CXXTryStmt>(Body), true); // Emit the destructor epilogue now. If this is a complete // destructor with a function-try-block, perform the base epilogue @@ -742,7 +739,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { // Exit the try if applicable. if (isTryBody) - ExitCXXTryStmt(*cast<CXXTryStmt>(Body), TryInfo); + ExitCXXTryStmt(*cast<CXXTryStmt>(Body), true); } /// EmitDtorEpilogue - Emit all code that comes at the end of class's |