56 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fobjc-exceptions -verify -Wunreachable-code %s2 3void f(void);4 5void g1(void) {6 @try {7 f();8 @throw @"";9 f(); // expected-warning{{will never be executed}}10 } @catch(id i) {11 f();12 }13 14 // Completely empty.15 @try {16 } @catch(...) {17 }18 19 @try {20 f();21 return;22 } @catch(id i = nil) { // Catch block should not be marked as unreachable.23 // Empty @catch body.24 }25}26 27void g2(void) {28 @try {29 // Nested @try.30 @try {31 f();32 @throw @"";33 f(); // expected-warning{{will never be executed}}34 } @catch(...) {35 }36 f();37 @throw @"";38 f(); // expected-warning{{will never be executed}}39 } @catch(...) {40 f();41 }42}43 44void g3(void) {45 @try {46 @try {47 f();48 } @catch (...) {49 @throw @""; // should exit outer try50 }51 @throw @"";52 f(); // expected-warning{{never be executed}}53 } @catch (...) {54 }55}56