brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · c9a5414 Raw
93 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 -std=gnu++98 -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 9void *sel_registerName(const char *);10 11@interface Foo @end12void TRY(void);13void SPLATCH(void);14void MYTRY(void);15void MYCATCH(void);16 17void foo(void) {18  @try  { TRY(); } 19  @catch (...) { SPLATCH(); @throw; }20}21 22int main(void)23{24 25  @try  {26     MYTRY();27  }28 29  @catch (Foo* localException) {30     MYCATCH();31     @throw localException;32  }33  34  // no catch clause35  @try { } 36  @finally { }37}38 39 40@interface INST41{42  INST* throw_val;43}44 45- (id) ThrowThis;46 47- (void) MainMeth;48 49@end50 51 52@implementation INST53- (id) ThrowThis { return 0; }54 55- (void) MainMeth {56  @try  {57     MYTRY();58  }59  @catch (Foo* localException) {60     MYCATCH();61     @throw [self ThrowThis];62  }63  @catch (...) {64    @throw [throw_val ThrowThis];65  }66}67@end68 69@class NSDictionary, NSException;70@class NSMutableDictionary;71 72@interface NSString73+ (id)stringWithFormat:(NSString *)format, ... ;74@end75 76@interface  NSException77+ (NSException *)exceptionWithName:(NSString *)name reason:(NSString *)reason userInfo:(NSDictionary *)userInfo;78@end79id *_imp__NSInvalidArgumentException;80 81@interface NSSetExpression @end82 83@implementation NSSetExpression84-(id)expressionValueWithObject:(id)object context:(NSMutableDictionary*)bindings {85    id leftSet;86    id rightSet;87    @throw [NSException exceptionWithName: *_imp__NSInvalidArgumentException reason: [NSString stringWithFormat: @"Can't evaluate set expression; left subexpression not a set (lhs = %@ rhs = %@)", leftSet, rightSet] userInfo: 0];88 89    return leftSet ;90}91@end92 93