brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · cdf79db Raw
64 lines · plain
1// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp2// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions  -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp3 4typedef struct objc_class *Class;5typedef struct objc_object {6    Class isa;7} *id;8 9extern int printf(const char *, ...);10 11int main(void) {12  @try {13  } 14  @finally {15  }16  while (1) {17    @try {18      printf("executing try");19      break;20    } @finally {21      printf("executing finally");22    }23    printf("executing after finally block");24  }25  @try {26    printf("executing try");27  } @finally {28    printf("executing finally");29  }30  return 0;31}32 33void test2_try_with_implicit_finally(void) {34    @try {35        return;36    } @catch (id e) {37        38    }39}40 41void FINALLY(void);42void TRY(void);43void CATCH(void);44 45@interface NSException46@end47 48@interface Foo49@end50 51@implementation Foo52- (void)bar {53    @try {54	TRY();55    } 56    @catch (NSException *e) {57	CATCH();58    }59    @finally {60	FINALLY();61    }62}63@end64