diff options
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 10 | ||||
-rw-r--r-- | test/CodeGenObjC/ivars.m | 14 |
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 67fc63c65a..4acc618103 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -4868,23 +4868,23 @@ LValue CGObjCNonFragileABIMac::EmitObjCValueForIvar( ObjCIvarOffsetVariable(ExternalName, ID, Ivar); // (char *) BaseValue - llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, - ObjCTypes.Int8PtrTy); + llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, ObjCTypes.Int8PtrTy); llvm::Value *Offset = CGF.Builder.CreateLoad(IvarOffsetGV); // (char*)BaseValue + Offset_symbol V = CGF.Builder.CreateGEP(V, Offset, "add.ptr"); // (type *)((char*)BaseValue + Offset_symbol) const llvm::Type *IvarTy = - CGM.getTypes().ConvertType(Ivar->getType()); + CGM.getTypes().ConvertTypeForMem(Ivar->getType()); llvm::Type *ptrIvarTy = llvm::PointerType::getUnqual(IvarTy); V = CGF.Builder.CreateBitCast(V, ptrIvarTy); if (Ivar->isBitField()) { + QualType FieldTy = Field->getType(); CodeGenTypes::BitFieldInfo bitFieldInfo = CGM.getTypes().getBitFieldInfo(Field); return LValue::MakeBitfield(V, bitFieldInfo.Begin, bitFieldInfo.Size, - Field->getType()->isSignedIntegerType(), - Field->getType().getCVRQualifiers()|CVRQualifiers); + FieldTy->isSignedIntegerType(), + FieldTy.getCVRQualifiers()|CVRQualifiers); } LValue LV = LValue::MakeAddr(V, diff --git a/test/CodeGenObjC/ivars.m b/test/CodeGenObjC/ivars.m new file mode 100644 index 0000000000..327b628532 --- /dev/null +++ b/test/CodeGenObjC/ivars.m @@ -0,0 +1,14 @@ +// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o - %s && +// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o - %s + +// rdar://6800926 +@interface ITF { +@public + unsigned field :1 ; + _Bool boolfield :1 ; +} +@end + +void foo(ITF *P) { + P->boolfield = 1; +} |