1 // RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-noreturn -fobjc-exceptions -Wno-objc-root-class %s 2 3 int test1() { 4 id a; 5 @throw a; 6 } 7 8 // PR5286 9 void test2(int a) { 10 while (1) { 11 if (a) 12 return; 13 } 14 } 15 16 // PR5286 17 void test3(int a) { // expected-warning {{function 'test3' could be declared with attribute 'noreturn'}} 18 while (1) { 19 if (a) 20 @throw (id)0; 21 } 22 } 23 24 // <rdar://problem/4289832> - This code always returns, we should not 25 // issue a noreturn warning. 26 @class NSException; 27 @class NSString; 28 NSString *rdar_4289832() { // no-warning 29 @try 30 { 31 return @"a"; 32 } 33 @catch(NSException *exception) 34 { 35 return @"b"; 36 } 37 @finally 38 { 39 } 40 } 41 42 void exit(int) __attribute__((noreturn)); 43 @interface rdar10098695 44 @end 45 46 @implementation rdar10098695 47 - (void)method { // expected-warning{{method 'method' could be declared with attribute 'noreturn'}} 48 exit(1); 49 } 50 @end 51