50 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-noreturn -fobjc-exceptions -Wno-objc-root-class %s2 3int test1(void) {4 id a;5 @throw a;6}7 8// PR52869void test2(int a) {10 while (1) {11 if (a)12 return;13 }14}15 16// PR528617void 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// This code always returns, we should not issue a noreturn warning.25@class NSException;26@class NSString;27NSString *rdar_4289832(void) { // no-warning28 @try29 {30 return @"a";31 }32 @catch(NSException *exception)33 {34 return @"b";35 }36 @finally37 {38 }39}40 41void exit(int) __attribute__((noreturn));42@interface rdar1009869543@end44 45@implementation rdar1009869546- (void)method { // expected-warning{{method 'method' could be declared with attribute 'noreturn'}}47 exit(1);48}49@end50