1 // RUN: %clang_cc1 -x objective-c -Wno-objc-root-class -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2 // RUN: FileCheck --input-file=%t-rw.cpp %s
4 typedef struct MyWidget {
8 MyWidget gWidget = { 17 };
17 @interface Bar: Foo <MyProto>
21 + (MyWidget *)elementForView:(Foo *)view;
28 - (MyWidget *)widget {
33 @implementation Container
34 + (MyWidget *)elementForView:(Foo *)view
36 MyWidget *widget = (void*)0;
37 if (@protocol(MyProto)) {
38 widget = [(id <MyProto>)view widget];
46 MyWidget *w = [Container elementForView: view];
53 @interface NSProtocolChecker
54 + (id)protocolCheckerWithTarget:(NSObject *)anObject protocol:(Protocol *)aProtocol;
57 @protocol NSConnectionVersionedProtocol
61 @interface NSConnection @end
63 @implementation NSConnection
65 [NSProtocolChecker protocolCheckerWithTarget:0 protocol:@protocol(NSConnectionVersionedProtocol)];
69 // CHECK: static struct _protocol_t *_OBJC_PROTOCOL_REFERENCE_$_NSConnectionVersionedProtocol = &_OBJC_PROTOCOL_NSConnectionVersionedProtocol
70 // CHECK: sel_registerName("protocolCheckerWithTarget:protocol:"), (NSObject *)0, (Protocol *)_OBJC_PROTOCOL_REFERENCE_$_NSConnectionVersionedProtocol