blob: 453d80fd599656d1d3943fcdfef00600250b733b [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Steve Naroff459a1e22008-06-03 05:36:54 +00002typedef 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
Fariborz Jahanian209a8c22009-10-20 16:39:13 +000033- (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError {
Steve Naroff459a1e22008-06-03 05:36:54 +000034 @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
Chris Lattnera868a202009-04-21 06:11:25 +000043 @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)}}
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}