[cfe-commits] r91335 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/nested-rethrow.m
Daniel Dunbar
daniel at zuster.org
Mon Dec 14 18:29:14 PST 2009
Hi Fariborz,
Should this test go into the LLVM test-suite?
- Daniel
On Mon, Dec 14, 2009 at 1:35 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Mon Dec 14 15:35:01 2009
> New Revision: 91335
>
> URL: http://llvm.org/viewvc/llvm-project?rev=91335&view=rev
> Log:
> Patch to fix 32-bit @try failure with internal assertion when compiling
> an Objective-C rethrow nested inside another try/catch block. (fixes radar 7466728).
>
>
> Added:
> cfe/trunk/test/CodeGenObjC/nested-rethrow.m
> Modified:
> cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=91335&r1=91334&r2=91335&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Dec 14 15:35:01 2009
> @@ -2541,8 +2541,11 @@
> // through finally.
> CGF.PushCleanupBlock(FinallyBlock);
>
> - CGF.ObjCEHValueStack.push_back(0);
> -
> + if (CGF.ObjCEHValueStack.empty())
> + CGF.ObjCEHValueStack.push_back(0);
> + // If This is a nested @try, caught exception is that of enclosing @try.
> + else
> + CGF.ObjCEHValueStack.push_back(CGF.ObjCEHValueStack.back());
> // Allocate memory for the exception data and rethrow pointer.
> llvm::Value *ExceptionData = CGF.CreateTempAlloca(ObjCTypes.ExceptionDataTy,
> "exceptiondata.ptr");
>
> Added: cfe/trunk/test/CodeGenObjC/nested-rethrow.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/nested-rethrow.m?rev=91335&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/nested-rethrow.m (added)
> +++ cfe/trunk/test/CodeGenObjC/nested-rethrow.m Mon Dec 14 15:35:01 2009
> @@ -0,0 +1,24 @@
> +// RUN: clang -cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
> +
> +#include <stdio.h>
> +
> +int main()
> +{
> + @try {
> + @throw @"foo";
> + } @catch (id e) {
> + @try {
> +// CHECK: call void @objc_exception_throw
> + @throw;
> + } @catch (id e) {
> + if (e) {
> + printf("caught \n");
> + } else {
> + printf("caught (WRONG)\n");
> + }
> + } @catch (...) {
> + printf("caught nothing (WRONG)\n");
> + }
> + }
> +}
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list