From 5889c60d19101156a3a54b8c49bcc60a12cc1fdb Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 13 Sep 2011 05:36:29 +0000 Subject: [PATCH] Always emit bitfield properties using expression behavior, even if they're 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 | 7 +++++++ test/CodeGenObjC/property.m | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 888f67d661..f0a47af909 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -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. diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index dd0786eb30..3cc9200f33 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -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 -- 2.40.0