blob: 16e119db80c4bcefd69bdaa1622383a1b3d6befb [file] [log] [blame]
Steve Naroff459a1e22008-06-03 05:36:54 +00001// RUN: clang -fsyntax-only -verify %s
2typedef signed char BOOL;
3typedef struct _NSZone NSZone;
4
5@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
6
7@protocol NSObject
8- (BOOL)isEqual:(id)object;
9@end
10
11@protocol NSCopying
12- (id)copyWithZone:(NSZone *)zone;
13@end
14
15@protocol NSCoding
16- (void)encodeWithCoder:(NSCoder *)aCoder;
17@end
18
19@interface NSObject <NSObject> {}
20@end
21
22@class NSData, NSArray, NSDictionary, NSCharacterSet, NSData, NSURL, NSError, NSLocale;
23
24@interface NSException : NSObject <NSCopying, NSCoding> {}
25@end
26
27@class ASTNode, XCRefactoringParser, Transform, TransformInstance, XCRefactoringSelectionInfo;
28
29@interface XCRefactoringTransformation : NSObject {}
30@end
31
32@implementation XCRefactoringTransformation
33- (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError; {
34 @try {}
35 // the exception name is optional (weird)
36 @catch (NSException *) {}
37}
Steve Naroff7151bbb2009-02-11 17:45:08 +000038@end
39
40int foo() {
Steve Naroff3dcfe102009-02-12 15:54:59 +000041 struct s { int a, b; } agg, *pagg;
42
43 @throw 42; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
44 @throw agg; // expected-error {{invalid 'struct s' argument (expected an ObjC object type)}}
45 @throw pagg; // expected-error {{invalid 'struct s *' argument (expected an ObjC object type)}}
Steve Narofffea25112009-02-11 22:01:48 +000046 @throw; // expected-error {{@throw (rethrow) used outside of a @catch block}}
Steve Naroff7151bbb2009-02-11 17:45:08 +000047}