Add include needed for MSVC.
[clang/acc.git] / test / SemaObjC / try-catch.m
blob076eff542968486ec5ee8a6bd785fd2a19c4404b
1 // RUN: clang-cc -fsyntax-only -verify %s
2 typedef signed char BOOL;
3 typedef struct _NSZone NSZone;
5 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
7 @protocol NSObject
8 - (BOOL)isEqual:(id)object;
9 @end
11 @protocol NSCopying
12 - (id)copyWithZone:(NSZone *)zone;
13 @end
15 @protocol NSCoding
16 - (void)encodeWithCoder:(NSCoder *)aCoder;
17 @end
19 @interface NSObject <NSObject> {}
20 @end
22 @class NSData, NSArray, NSDictionary, NSCharacterSet, NSData, NSURL, NSError, NSLocale;
24 @interface NSException : NSObject <NSCopying, NSCoding> {}
25 @end
27 @class ASTNode, XCRefactoringParser, Transform, TransformInstance, XCRefactoringSelectionInfo;
29 @interface XCRefactoringTransformation : NSObject {}
30 @end
32 @implementation XCRefactoringTransformation
33 - (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError; {
34     @try {}
35     // the exception name is optional (weird)
36     @catch (NSException *) {}
38 @end
40 int foo() {
41   struct s { int a, b; } agg, *pagg;
43   @throw 42; // expected-error {{@throw requires an Objective-C object type ('int' invalid))}}
44   @throw agg; // expected-error {{@throw requires an Objective-C object type ('struct s' invalid)}}
45   @throw pagg; // expected-error {{@throw requires an Objective-C object type ('struct s *' invalid)}}
46   @throw; // expected-error {{@throw (rethrow) used outside of a @catch block}}