Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Steve Naroff | 459a1e2 | 2008-06-03 05:36:54 +0000 | [diff] [blame] | 2 | typedef signed char BOOL; |
| 3 | typedef 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 Jahanian | 209a8c2 | 2009-10-20 16:39:13 +0000 | [diff] [blame] | 33 | - (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError { |
Steve Naroff | 459a1e2 | 2008-06-03 05:36:54 +0000 | [diff] [blame] | 34 | @try {} |
| 35 | // the exception name is optional (weird) |
| 36 | @catch (NSException *) {} |
| 37 | } |
Steve Naroff | 7151bbb | 2009-02-11 17:45:08 +0000 | [diff] [blame] | 38 | @end |
| 39 | |
| 40 | int foo() { |
Steve Naroff | 3dcfe10 | 2009-02-12 15:54:59 +0000 | [diff] [blame] | 41 | struct s { int a, b; } agg, *pagg; |
| 42 | |
Chris Lattner | a868a20 | 2009-04-21 06:11:25 +0000 | [diff] [blame] | 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)}} |
Steve Naroff | fea2511 | 2009-02-11 22:01:48 +0000 | [diff] [blame] | 46 | @throw; // expected-error {{@throw (rethrow) used outside of a @catch block}} |
Steve Naroff | 7151bbb | 2009-02-11 17:45:08 +0000 | [diff] [blame] | 47 | } |