• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2// rdar://20255473
3
4@interface NSObject @end
5
6typedef NSObject * __attribute__((objc_independent_class))dispatch_queue_t;
7
8typedef struct S {int ii; } * __attribute__((objc_independent_class))dispatch_queue_t_2; // expected-warning {{Objective-C object}}
9
10typedef struct { // expected-warning {{'objc_independent_class' attribute may be put on a typedef only; attribute is ignored}}
11   NSObject *__attribute__((objc_independent_class)) ns; // expected-warning {{'objc_independent_class' attribute may be put on a typedef only; attribute is ignored}}
12} __attribute__((objc_independent_class)) T;
13
14dispatch_queue_t dispatch_queue_create();
15
16@interface DispatchQPointerCastIssue : NSObject {
17  NSObject *__attribute__((objc_independent_class)) Ivar; // expected-warning {{'objc_independent_class' attribute may be put on a typedef only; attribute is ignored}}
18}
19
20@property (copy) NSObject *__attribute__((objc_independent_class)) Prop; // expected-warning {{'objc_independent_class' attribute may be put on a typedef only; attribute is ignored}}
21
22typedef NSObject * __attribute__((objc_independent_class))dispatch_queue_t_1;
23
24@end
25
26@implementation DispatchQPointerCastIssue
27+ (dispatch_queue_t) newDispatchQueue {
28    return dispatch_queue_create();
29}
30@end
31
32NSObject *get_nsobject() {
33  typedef NSObject * __attribute__((objc_independent_class))dispatch_queue_t;
34  dispatch_queue_t dt;
35  return dt;
36}
37