]> granicus.if.org Git - clang/commitdiff
Add test case for <rdar://problem/4289832>. Clang actuallys gets
authorTed Kremenek <kremenek@apple.com>
Tue, 29 Jun 2010 20:25:42 +0000 (20:25 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 29 Jun 2010 20:25:42 +0000 (20:25 +0000)
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107203 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaObjC/return.m

index c578bf3b6569f3ec4c7e47a62324e250e00dce85..116abd19e7e74fb53579ed2f8b9626bbb9f99838 100644 (file)
@@ -20,3 +20,22 @@ void test3(int a) {  // expected-warning {{function could be attribute 'noreturn
       @throw (id)0;
   }
 }
+
+// <rdar://problem/4289832> - This code always returns, we should not
+//  issue a noreturn warning.
+@class NSException;
+@class NSString;
+NSString *rdar_4289832() {  // no-warning
+    @try
+    {
+        return @"a";
+    }
+    @catch(NSException *exception)
+    {
+        return @"b";
+    }
+    @finally
+    {
+    }
+}
+