Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin9 -Wno-objc-root-class %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Douglas Gregor | 1a0d31a | 2009-01-12 18:45:55 +0000 | [diff] [blame] | 3 | // FIXME: must also compile as Objective-C++ |
| 4 | |
| 5 | // <rdar://problem/6487662> |
| 6 | typedef struct objc_selector *SEL; |
| 7 | typedef signed char BOOL; |
| 8 | typedef unsigned int NSUInteger; |
| 9 | typedef struct _NSZone NSZone; |
| 10 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 11 | @protocol NSObject |
| 12 | - (BOOL)isEqual:(id)object; |
| 13 | - (BOOL)respondsToSelector:(SEL)aSelector; |
| 14 | @end |
| 15 | @protocol NSCopying |
| 16 | - (id)copyWithZone:(NSZone *)zone; |
| 17 | @end |
| 18 | @protocol NSMutableCopying |
| 19 | - (id)mutableCopyWithZone:(NSZone *)zone; |
| 20 | @end |
| 21 | @protocol NSCoding |
| 22 | - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 23 | @end |
| 24 | @interface NSObject <NSObject> {} |
| 25 | @end |
| 26 | @class NSString, NSData; |
| 27 | typedef struct _NSPoint {} |
| 28 | NSRange; |
| 29 | @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> |
| 30 | - (NSUInteger)length; |
| 31 | @end |
| 32 | @interface NSMutableString : NSString |
| 33 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString; |
| 34 | @end |
| 35 | @class NSArray, NSDictionary, NSMapTable; |
| 36 | @interface NSResponder : NSObject <NSCoding> {} |
| 37 | @end |
| 38 | @protocol NSAnimatablePropertyContainer |
| 39 | - (id)animator; |
| 40 | @end |
| 41 | extern NSString *NSAnimationTriggerOrderIn ; |
| 42 | @interface NSView : NSResponder <NSAnimatablePropertyContainer> { |
| 43 | struct __VFlags2 {} _vFlags2; |
| 44 | } |
| 45 | @end |
| 46 | @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView; |
| 47 | @interface FooiagramView : NSView { |
| 48 | id _delegate; |
| 49 | } |
| 50 | @end |
| 51 | @class FooiagramView; |
| 52 | @interface _FooiagramViewReserved : NSObject { |
| 53 | @public |
| 54 | NSMutableString *_typeToSelectString; |
| 55 | struct _FooiagramViewFlags { |
| 56 | unsigned int delegateRespondsToPrintInfoForBarView : 1; |
| 57 | } _dvFlags; |
| 58 | } |
| 59 | @end |
| 60 | extern _FooiagramViewReserved *_FooiagramViewBarViewReserved(FooiagramView *BarView); |
| 61 | @interface FooiagramView (FooiagramViewPrivate) |
| 62 | + (Class)_defaultBarToolManagerClass; |
| 63 | @end |
| 64 | @implementation FooiagramView |
| 65 | static NSMapTable *_defaultMenuForClass = 0; |
| 66 | - (void)setDelegate:(id)delegate { |
| 67 | if (_delegate != delegate) { |
| 68 | struct _FooiagramViewFlags *dvFlags = |
| 69 | &_FooiagramViewBarViewReserved(self)->_dvFlags; |
| 70 | if (_delegate != ((void *)0)) { |
| 71 | dvFlags->delegateRespondsToPrintInfoForBarView = [_delegate respondsToSelector:@selector(printInfoForBarView:)]; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | @end |
| 76 | |
| 77 | // <rdar://problem/6487684> |
| 78 | @interface WizKing_MIKeep { |
| 79 | struct __LoreStuffNode *_historyStuff; |
| 80 | } |
| 81 | @end |
| 82 | typedef struct __LoreStuffNode {} LoreStuffNode; |
| 83 | @implementation WizKing_MIKeep |
| 84 | - init { |
| 85 | LoreStuffNode *node; |
| 86 | node = &(_historyStuff[1]); |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 87 | return 0; |
Douglas Gregor | 1a0d31a | 2009-01-12 18:45:55 +0000 | [diff] [blame] | 88 | } |
| 89 | @end |
| 90 | |
| 91 | // <rdar://problem/6487702> |
| 92 | typedef long unsigned int __darwin_size_t; |
| 93 | typedef __darwin_size_t size_t; |
| 94 | void *memset(void *, int, size_t); |
| 95 | @class NSString, NSURL, NSError; |
| 96 | @interface OingoWerdnaPeon : NSObject {} |
| 97 | @end typedef enum { |
| 98 | OingoPT_SmashOK, OingoPT_NoSuchFile, } |
| 99 | OingoWerdnaPeonIOMethod; |
| 100 | @interface OingoWerdnaPeonSmashDrivel : NSObject <NSCopying> {} |
| 101 | @end |
| 102 | @interface OingoBoingoContraptionPeon : OingoWerdnaPeon { |
| 103 | struct _OingoBoingoContraptionPeonFlags {} |
| 104 | _nfttFlags; |
| 105 | } |
| 106 | @end |
| 107 | @implementation OingoBoingoContraptionPeon |
| 108 | + (void)initialize {} |
| 109 | - (id)initWithSmashDrivel:(OingoWerdnaPeonSmashDrivel *)info { |
| 110 | if (self != ((void *)0)) { |
| 111 | (void)memset(&_nfttFlags, 0, sizeof(struct _OingoBoingoContraptionPeonFlags)); |
| 112 | } |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 113 | return 0; |
Douglas Gregor | 1a0d31a | 2009-01-12 18:45:55 +0000 | [diff] [blame] | 114 | } |
| 115 | @end |
| 116 | |
| 117 | @interface Blah { |
| 118 | struct X { |
| 119 | int x; |
| 120 | } value; |
| 121 | } |
| 122 | @end |
| 123 | |
| 124 | @implementation Blah |
| 125 | - (int)getValue { |
| 126 | struct X *xp = &value; |
| 127 | return xp->x; |
| 128 | } |
| 129 | @end |