1// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin9 -Wno-objc-root-class %s
2// expected-no-diagnostics
3// FIXME: must also compile as Objective-C++
4
5// <rdar://problem/6487662>
6typedef struct objc_selector *SEL;
7typedef signed char BOOL;
8typedef unsigned int NSUInteger;
9typedef 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;
27typedef struct _NSPoint {}
28NSRange;
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
41extern 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 {
48id _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
60extern _FooiagramViewReserved *_FooiagramViewBarViewReserved(FooiagramView *BarView);
61@interface FooiagramView (FooiagramViewPrivate)
62+ (Class)_defaultBarToolManagerClass;
63@end
64@implementation FooiagramView
65static 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 {
79struct __LoreStuffNode *_historyStuff;
80}
81@end
82typedef struct __LoreStuffNode {} LoreStuffNode;
83@implementation WizKing_MIKeep
84- init {
85  LoreStuffNode *node;
86  node = &(_historyStuff[1]);
87  return 0;
88}
89@end
90
91// <rdar://problem/6487702>
92typedef long unsigned int __darwin_size_t;
93typedef __darwin_size_t size_t;
94void *memset(void *, int, size_t);
95@class NSString, NSURL, NSError;
96@interface OingoWerdnaPeon : NSObject {}
97@end        typedef enum {
98OingoPT_SmashOK,     OingoPT_NoSuchFile, }
99OingoWerdnaPeonIOMethod;
100@interface OingoWerdnaPeonSmashDrivel : NSObject <NSCopying> {}
101@end
102@interface OingoBoingoContraptionPeon : OingoWerdnaPeon {
103struct _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  }
113  return 0;
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
130