xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/objc-modern-property-bitfield.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
3*f4a2713aSLionel Sambuc// rdar://13138459
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambucvoid *sel_registerName(const char *);
6*f4a2713aSLionel Sambucextern void abort();
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@interface NSObject
9*f4a2713aSLionel Sambuc+ alloc;
10*f4a2713aSLionel Sambuc- init;
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuctypedef unsigned char BOOL;
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface Foo : NSObject {
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc   BOOL  _field1 : 5;
18*f4a2713aSLionel Sambuc   BOOL  _field2    : 3;
19*f4a2713aSLionel Sambuc}
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@property BOOL field1;
22*f4a2713aSLionel Sambuc@property BOOL field2;
23*f4a2713aSLionel Sambuc@end
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc@implementation Foo
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc@synthesize field1 = _field1;
28*f4a2713aSLionel Sambuc@synthesize field2 = _field2;
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc@end
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambucint main()
33*f4a2713aSLionel Sambuc{
34*f4a2713aSLionel Sambuc  Foo *f = (Foo*)[[Foo alloc] init];
35*f4a2713aSLionel Sambuc  f.field1 = 0xF;
36*f4a2713aSLionel Sambuc  f.field2 = 0x3;
37*f4a2713aSLionel Sambuc  f.field1 = f.field1 & f.field2;
38*f4a2713aSLionel Sambuc  if (f.field1 != 0x3)
39*f4a2713aSLionel Sambuc    abort ();
40*f4a2713aSLionel Sambuc  return 0;
41*f4a2713aSLionel Sambuc}
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambuc
44