xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/opaque-is-access-warn.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang -target x86_64-apple-darwin -arch arm64 -mios-version-min=7 -fsyntax-only -Wdeprecated-objc-isa-usage %s -Xclang -verify
2*0a6a1f1dSLionel Sambuc// RUN: %clang -target x86_64-apple-darwin -arch arm64 -mios-version-min=7 -fsyntax-only %s -Xclang -verify
3*0a6a1f1dSLionel Sambuc// RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=7 -fsyntax-only -Wdeprecated-objc-isa-usage %s -Xclang -verify
4*0a6a1f1dSLionel Sambuc// rdar://10709102
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuctypedef struct objc_object {
7*0a6a1f1dSLionel Sambuc  struct objc_class *isa;
8*0a6a1f1dSLionel Sambuc} *id;
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc@interface NSObject {
11*0a6a1f1dSLionel Sambuc  struct objc_class *isa;
12*0a6a1f1dSLionel Sambuc}
13*0a6a1f1dSLionel Sambuc@end
14*0a6a1f1dSLionel Sambuc@interface Whatever : NSObject
15*0a6a1f1dSLionel Sambuc+self;
16*0a6a1f1dSLionel Sambuc@end
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambucstatic void func() {
19*0a6a1f1dSLionel Sambuc
20*0a6a1f1dSLionel Sambuc  id x;
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel Sambuc  [(*x).isa self]; // expected-error {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
23*0a6a1f1dSLionel Sambuc  [x->isa self];   // expected-error {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
24*0a6a1f1dSLionel Sambuc}
25