r283795 - Make the LValue created in EmitValueForIvarAtOffset have the same Qualifiers in the LValue as the QualType in the LValue. No functionality change intended.

Nick Lewycky via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 13:07:14 PDT 2016


Author: nicholas
Date: Mon Oct 10 15:07:13 2016
New Revision: 283795

URL: http://llvm.org/viewvc/llvm-project?rev=283795&view=rev
Log:
Make the LValue created in EmitValueForIvarAtOffset have the same Qualifiers in the LValue as the QualType in the LValue. No functionality change intended.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp?rev=283795&r1=283794&r2=283795&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp Mon Oct 10 15:07:13 2016
@@ -90,7 +90,7 @@ LValue CGObjCRuntime::EmitValueForIvarAt
                                                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::EmitValueForIvarAt
   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::EmitValueForIvarAt
   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 {




More information about the cfe-commits mailing list