]> granicus.if.org Git - clang/commitdiff
Always emit bitfield properties using expression behavior, even if they're
authorJohn McCall <rjmccall@apple.com>
Tue, 13 Sep 2011 05:36:29 +0000 (05:36 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 13 Sep 2011 05:36:29 +0000 (05:36 +0000)
atomic.  This is probably something we should warn about.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139584 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjC.cpp
test/CodeGenObjC/property.m

index 888f67d6618ea5d067a1459b0eba13a0844a3763..f0a47af909e01dfe9ba8e9e1859b333ce7118fbe 100644 (file)
@@ -495,6 +495,13 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
     return;
   }
 
+  // Properties on bitfield ivars need to be emitted using expression
+  // accesses even if they're nominally atomic.
+  if (ivar->isBitField()) {
+    Kind = Expression;
+    return;
+  }
+
   // GC-qualified or ARC-qualified ivars need to be emitted as
   // expressions.  This actually works out to being atomic anyway,
   // except for ARC __strong, but that should trigger the above code.
index dd0786eb30ee0ec4d24426089fcdf7af36eb1e70..3cc9200f333c8772add5ea48fd7206d9996b980f 100644 (file)
@@ -103,3 +103,12 @@ void test4(Test4 *t) {
   // CHECK-NEXT: ret void
   test4_printf("%.2f", t.f);
 }
+
+@interface Test5 {
+  unsigned _x : 5;
+}
+@property unsigned x;
+@end
+@implementation Test5
+@synthesize x = _x;
+@end