]> granicus.if.org Git - clang/commitdiff
Make the LValue created in EmitValueForIvarAtOffset have the same Qualifiers in the...
authorNick Lewycky <nicholas@mxc.ca>
Mon, 10 Oct 2016 20:07:13 +0000 (20:07 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Mon, 10 Oct 2016 20:07:13 +0000 (20:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283795 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCRuntime.cpp

index 0caf6d9f210af065cd7e58826b7d55e109c980e8..ebc829272e7cf1ceee8924634bb44aa5f76a2230 100644 (file)
@@ -90,7 +90,7 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
                                                unsigned CVRQualifiers,
                                                llvm::Value *Offset) {
   // Compute (type*) ( (char *) BaseValue + Offset)
-  QualType IvarTy = Ivar->getType();
+  QualType IvarTy = Ivar->getType().withCVRQualifiers(CVRQualifiers);
   llvm::Type *LTy = CGF.CGM.getTypes().ConvertTypeForMem(IvarTy);
   llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, CGF.Int8PtrTy);
   V = CGF.Builder.CreateInBoundsGEP(V, Offset, "add.ptr");
@@ -98,7 +98,6 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
   if (!Ivar->isBitField()) {
     V = CGF.Builder.CreateBitCast(V, llvm::PointerType::getUnqual(LTy));
     LValue LV = CGF.MakeNaturalAlignAddrLValue(V, IvarTy);
-    LV.getQuals().addCVRQualifiers(CVRQualifiers);
     return LV;
   }
 
@@ -139,9 +138,7 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF,
   Addr = CGF.Builder.CreateElementBitCast(Addr,
                                    llvm::Type::getIntNTy(CGF.getLLVMContext(),
                                                          Info->StorageSize));
-  return LValue::MakeBitfield(Addr, *Info,
-                              IvarTy.withCVRQualifiers(CVRQualifiers),
-                              AlignmentSource::Decl);
+  return LValue::MakeBitfield(Addr, *Info, IvarTy, AlignmentSource::Decl);
 }
 
 namespace {