Kill the KVC l-value kind and calculate the base expression when emitting
the l-value. llvm-svn: 120884
This commit is contained in:
		
							parent
							
								
									7788e5fd64
								
							
						
					
					
						commit
						f3eb96fccf
					
				| 
						 | 
				
			
			@ -195,11 +195,9 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E,
 | 
			
		|||
  if (E->isLValue()) {
 | 
			
		||||
    // Emit the expression as an lvalue.
 | 
			
		||||
    LValue LV = CGF.EmitLValue(E);
 | 
			
		||||
    if (LV.isPropertyRef() || LV.isKVCRef()) {
 | 
			
		||||
    if (LV.isPropertyRef()) {
 | 
			
		||||
      QualType QT = E->getType();
 | 
			
		||||
      RValue RV = 
 | 
			
		||||
        LV.isPropertyRef() ? CGF.EmitLoadOfPropertyRefLValue(LV, QT) 
 | 
			
		||||
                           : CGF.EmitLoadOfKVCRefLValue(LV, QT);
 | 
			
		||||
      RValue RV = CGF.EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
      assert(RV.isScalar() && "EmitExprForReferenceBinding");
 | 
			
		||||
      return RV.getScalarVal();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -671,11 +669,8 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) {
 | 
			
		|||
  if (LV.isBitField())
 | 
			
		||||
    return EmitLoadOfBitfieldLValue(LV, ExprType);
 | 
			
		||||
 | 
			
		||||
  if (LV.isPropertyRef())
 | 
			
		||||
    return EmitLoadOfPropertyRefLValue(LV, ExprType);
 | 
			
		||||
 | 
			
		||||
  assert(LV.isKVCRef() && "Unknown LValue type!");
 | 
			
		||||
  return EmitLoadOfKVCRefLValue(LV, ExprType);
 | 
			
		||||
  assert(LV.isPropertyRef() && "Unknown LValue type!");
 | 
			
		||||
  return EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV,
 | 
			
		||||
| 
						 | 
				
			
			@ -750,16 +745,6 @@ RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV,
 | 
			
		|||
  return RValue::get(Res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RValue CodeGenFunction::EmitLoadOfPropertyRefLValue(LValue LV,
 | 
			
		||||
                                                    QualType ExprType) {
 | 
			
		||||
  return EmitObjCPropertyGet(LV.getPropertyRefExpr());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RValue CodeGenFunction::EmitLoadOfKVCRefLValue(LValue LV,
 | 
			
		||||
                                               QualType ExprType) {
 | 
			
		||||
  return EmitObjCPropertyGet(LV.getKVCRefExpr());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// If this is a reference to a subset of the elements of a vector, create an
 | 
			
		||||
// appropriate shufflevector.
 | 
			
		||||
RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
 | 
			
		||||
| 
						 | 
				
			
			@ -820,11 +805,8 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
 | 
			
		|||
    if (Dst.isBitField())
 | 
			
		||||
      return EmitStoreThroughBitfieldLValue(Src, Dst, Ty);
 | 
			
		||||
 | 
			
		||||
    if (Dst.isPropertyRef())
 | 
			
		||||
      return EmitStoreThroughPropertyRefLValue(Src, Dst, Ty);
 | 
			
		||||
 | 
			
		||||
    assert(Dst.isKVCRef() && "Unknown LValue type");
 | 
			
		||||
    return EmitStoreThroughKVCRefLValue(Src, Dst, Ty);
 | 
			
		||||
    assert(Dst.isPropertyRef() && "Unknown LValue type");
 | 
			
		||||
    return EmitStoreThroughPropertyRefLValue(Src, Dst);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (Dst.isObjCWeak() && !Dst.isNonGC()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -969,18 +951,6 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CodeGenFunction::EmitStoreThroughPropertyRefLValue(RValue Src,
 | 
			
		||||
                                                        LValue Dst,
 | 
			
		||||
                                                        QualType Ty) {
 | 
			
		||||
  EmitObjCPropertySet(Dst.getPropertyRefExpr(), Src);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CodeGenFunction::EmitStoreThroughKVCRefLValue(RValue Src,
 | 
			
		||||
                                                   LValue Dst,
 | 
			
		||||
                                                   QualType Ty) {
 | 
			
		||||
  EmitObjCPropertySet(Dst.getKVCRefExpr(), Src);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
 | 
			
		||||
                                                               LValue Dst,
 | 
			
		||||
                                                               QualType Ty) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1569,7 +1539,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
 | 
			
		|||
    BaseQuals = PTy->getPointeeType().getQualifiers();
 | 
			
		||||
  } else if (ObjCPropertyRefExpr *PRE
 | 
			
		||||
               = dyn_cast<ObjCPropertyRefExpr>(BaseExpr->IgnoreParens())) {
 | 
			
		||||
    RValue RV = EmitObjCPropertyGet(PRE);
 | 
			
		||||
    RValue RV = EmitLoadOfPropertyRefLValue(EmitObjCPropertyRefLValue(PRE));
 | 
			
		||||
    BaseValue = RV.getAggregateAddr();
 | 
			
		||||
    BaseQuals = BaseExpr->getType().getQualifiers();
 | 
			
		||||
  } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -1788,11 +1758,9 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
 | 
			
		|||
  case CK_NoOp:
 | 
			
		||||
    if (!E->getSubExpr()->isRValue() || E->getType()->isRecordType()) {
 | 
			
		||||
      LValue LV = EmitLValue(E->getSubExpr());
 | 
			
		||||
      if (LV.isPropertyRef() || LV.isKVCRef()) {
 | 
			
		||||
      if (LV.isPropertyRef()) {
 | 
			
		||||
        QualType QT = E->getSubExpr()->getType();
 | 
			
		||||
        RValue RV = 
 | 
			
		||||
          LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT) 
 | 
			
		||||
                             : EmitLoadOfKVCRefLValue(LV, QT);
 | 
			
		||||
        RValue RV = EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
        assert(RV.isAggregate());
 | 
			
		||||
        llvm::Value *V = RV.getAggregateAddr();
 | 
			
		||||
        return MakeAddrLValue(V, QT);
 | 
			
		||||
| 
						 | 
				
			
			@ -1861,11 +1829,9 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
 | 
			
		|||
    
 | 
			
		||||
    LValue LV = EmitLValue(E->getSubExpr());
 | 
			
		||||
    llvm::Value *This;
 | 
			
		||||
    if (LV.isPropertyRef() || LV.isKVCRef()) {
 | 
			
		||||
    if (LV.isPropertyRef()) {
 | 
			
		||||
      QualType QT = E->getSubExpr()->getType();
 | 
			
		||||
      RValue RV = 
 | 
			
		||||
        LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT)
 | 
			
		||||
                           : EmitLoadOfKVCRefLValue(LV, QT);
 | 
			
		||||
      RValue RV = EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
      assert (!RV.isScalar() && "EmitCastLValue");
 | 
			
		||||
      This = RV.getAggregateAddr();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2107,9 +2073,15 @@ CodeGenFunction::EmitObjCPropertyRefLValue(const ObjCPropertyRefExpr *E) {
 | 
			
		|||
  // This is a special l-value that just issues sends when we load or
 | 
			
		||||
  // store through it.
 | 
			
		||||
 | 
			
		||||
  if (E->isImplicitProperty())
 | 
			
		||||
    return LValue::MakeKVCRef(E, E->getType().getCVRQualifiers());
 | 
			
		||||
  return LValue::MakePropertyRef(E, E->getType().getCVRQualifiers());
 | 
			
		||||
  // For certain base kinds, we need to emit the base immediately.
 | 
			
		||||
  llvm::Value *Base;
 | 
			
		||||
  if (E->isSuperReceiver())
 | 
			
		||||
    Base = 0;
 | 
			
		||||
  else if (E->isClassReceiver())
 | 
			
		||||
    Base = CGM.getObjCRuntime().GetClass(Builder, E->getClassReceiver());
 | 
			
		||||
  else
 | 
			
		||||
    Base = EmitScalarExpr(E->getBase());
 | 
			
		||||
  return LValue::MakePropertyRef(E, Base);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -349,7 +349,8 @@ void AggExprEmitter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void AggExprEmitter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
 | 
			
		||||
  RValue RV = CGF.EmitObjCPropertyGet(E, getReturnValueSlot());
 | 
			
		||||
  RValue RV = CGF.EmitLoadOfPropertyRefLValue(CGF.EmitObjCPropertyRefLValue(E),
 | 
			
		||||
                                              getReturnValueSlot());
 | 
			
		||||
  EmitGCMove(E, RV);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -388,11 +389,7 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
 | 
			
		|||
  if (LHS.isPropertyRef()) {
 | 
			
		||||
    AggValueSlot Slot = EnsureSlot(E->getRHS()->getType());
 | 
			
		||||
    CGF.EmitAggExpr(E->getRHS(), Slot);
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), Slot.asRValue());
 | 
			
		||||
  } else if (LHS.isKVCRef()) {
 | 
			
		||||
    AggValueSlot Slot = EnsureSlot(E->getRHS()->getType());
 | 
			
		||||
    CGF.EmitAggExpr(E->getRHS(), Slot);
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), Slot.asRValue());
 | 
			
		||||
    CGF.EmitStoreThroughPropertyRefLValue(Slot.asRValue(), LHS);
 | 
			
		||||
  } else {
 | 
			
		||||
    bool GCollection = false;
 | 
			
		||||
    if (CGF.getContext().getLangOptions().getGCMode())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,11 +124,9 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
 | 
			
		|||
    This = EmitScalarExpr(ME->getBase());
 | 
			
		||||
  else {
 | 
			
		||||
    LValue BaseLV = EmitLValue(ME->getBase());
 | 
			
		||||
    if (BaseLV.isPropertyRef() || BaseLV.isKVCRef()) {
 | 
			
		||||
    if (BaseLV.isPropertyRef()) {
 | 
			
		||||
      QualType QT = ME->getBase()->getType();
 | 
			
		||||
      RValue RV = 
 | 
			
		||||
        BaseLV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(BaseLV, QT)
 | 
			
		||||
          : EmitLoadOfKVCRefLValue(BaseLV, QT);
 | 
			
		||||
      RValue RV = EmitLoadOfPropertyRefLValue(BaseLV);
 | 
			
		||||
      This = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
| 
						 | 
				
			
			@ -242,13 +240,10 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
 | 
			
		|||
             "EmitCXXOperatorMemberCallExpr - user declared copy assignment");
 | 
			
		||||
      LValue LV = EmitLValue(E->getArg(0));
 | 
			
		||||
      llvm::Value *This;
 | 
			
		||||
      if (LV.isPropertyRef() || LV.isKVCRef()) {
 | 
			
		||||
      if (LV.isPropertyRef()) {
 | 
			
		||||
        AggValueSlot Slot = CreateAggTemp(E->getArg(1)->getType());
 | 
			
		||||
        EmitAggExpr(E->getArg(1), Slot);
 | 
			
		||||
        if (LV.isPropertyRef())
 | 
			
		||||
          EmitObjCPropertySet(LV.getPropertyRefExpr(), Slot.asRValue());
 | 
			
		||||
        else
 | 
			
		||||
          EmitObjCPropertySet(LV.getKVCRefExpr(), Slot.asRValue());
 | 
			
		||||
        EmitStoreThroughPropertyRefLValue(Slot.asRValue(), LV);
 | 
			
		||||
        return RValue::getAggregate(0, false);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
| 
						 | 
				
			
			@ -267,11 +262,9 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
 | 
			
		|||
                                   FPT->isVariadic());
 | 
			
		||||
  LValue LV = EmitLValue(E->getArg(0));
 | 
			
		||||
  llvm::Value *This;
 | 
			
		||||
  if (LV.isPropertyRef() || LV.isKVCRef()) {
 | 
			
		||||
  if (LV.isPropertyRef()) {
 | 
			
		||||
    QualType QT = E->getArg(0)->getType();
 | 
			
		||||
    RValue RV = 
 | 
			
		||||
      LV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(LV, QT)
 | 
			
		||||
                         : EmitLoadOfKVCRefLValue(LV, QT);
 | 
			
		||||
    RValue RV = EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
    assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr");
 | 
			
		||||
    This = RV.getAggregateAddr();
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,11 +64,8 @@ public:
 | 
			
		|||
    if (LV.isSimple())
 | 
			
		||||
      return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified());
 | 
			
		||||
 | 
			
		||||
    if (LV.isPropertyRef())
 | 
			
		||||
      return CGF.EmitObjCPropertyGet(LV.getPropertyRefExpr()).getComplexVal();
 | 
			
		||||
 | 
			
		||||
    assert(LV.isKVCRef() && "Unknown LValue type!");
 | 
			
		||||
    return CGF.EmitObjCPropertyGet(LV.getKVCRefExpr()).getComplexVal();
 | 
			
		||||
    assert(LV.isPropertyRef() && "Unknown LValue type!");
 | 
			
		||||
    return CGF.EmitLoadOfPropertyRefLValue(LV).getComplexVal();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// EmitLoadOfComplex - Given a pointer to a complex value, emit code to load
 | 
			
		||||
| 
						 | 
				
			
			@ -531,11 +528,7 @@ EmitCompoundAssignLValue(const CompoundAssignOperator *E,
 | 
			
		|||
  // We know the LHS is a complex lvalue.
 | 
			
		||||
  ComplexPairTy LHSComplexPair;
 | 
			
		||||
  if (LHS.isPropertyRef())
 | 
			
		||||
    LHSComplexPair =
 | 
			
		||||
      CGF.EmitObjCPropertyGet(LHS.getPropertyRefExpr()).getComplexVal();
 | 
			
		||||
  else if (LHS.isKVCRef())
 | 
			
		||||
    LHSComplexPair =
 | 
			
		||||
      CGF.EmitObjCPropertyGet(LHS.getKVCRefExpr()).getComplexVal();
 | 
			
		||||
    LHSComplexPair = CGF.EmitLoadOfPropertyRefLValue(LHS).getComplexVal();
 | 
			
		||||
  else
 | 
			
		||||
    LHSComplexPair = EmitLoadOfComplex(LHS.getAddress(),
 | 
			
		||||
                                       LHS.isVolatileQualified());
 | 
			
		||||
| 
						 | 
				
			
			@ -551,10 +544,7 @@ EmitCompoundAssignLValue(const CompoundAssignOperator *E,
 | 
			
		|||
 | 
			
		||||
  // Store the result value into the LHS lvalue.
 | 
			
		||||
  if (LHS.isPropertyRef())
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(),
 | 
			
		||||
                            RValue::getComplex(Result));
 | 
			
		||||
  else if (LHS.isKVCRef())
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Result));
 | 
			
		||||
    CGF.EmitStoreThroughPropertyRefLValue(RValue::getComplex(Result), LHS);
 | 
			
		||||
  else
 | 
			
		||||
    EmitStoreOfComplex(Result, LHS.getAddress(), LHS.isVolatileQualified());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -573,7 +563,7 @@ EmitCompoundAssign(const CompoundAssignOperator *E,
 | 
			
		|||
    return Val;
 | 
			
		||||
 | 
			
		||||
  // Objective-C property assignment never reloads the value following a store.
 | 
			
		||||
  if (LV.isPropertyRef() || LV.isKVCRef())
 | 
			
		||||
  if (LV.isPropertyRef())
 | 
			
		||||
    return Val;
 | 
			
		||||
 | 
			
		||||
  // If the lvalue is non-volatile, return the computed value of the assignment.
 | 
			
		||||
| 
						 | 
				
			
			@ -599,9 +589,7 @@ LValue ComplexExprEmitter::EmitBinAssignLValue(const BinaryOperator *E,
 | 
			
		|||
 | 
			
		||||
  // Store the result value into the LHS lvalue.
 | 
			
		||||
  if (LHS.isPropertyRef())
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Val));
 | 
			
		||||
  else if (LHS.isKVCRef())
 | 
			
		||||
    CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Val));
 | 
			
		||||
    CGF.EmitStoreThroughPropertyRefLValue(RValue::getComplex(Val), LHS);
 | 
			
		||||
  else
 | 
			
		||||
    EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -617,7 +605,7 @@ ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) {
 | 
			
		|||
    return Val;
 | 
			
		||||
 | 
			
		||||
  // Objective-C property assignment never reloads the value following a store.
 | 
			
		||||
  if (LV.isPropertyRef() || LV.isKVCRef())
 | 
			
		||||
  if (LV.isPropertyRef())
 | 
			
		||||
    return Val;
 | 
			
		||||
 | 
			
		||||
  // If the lvalue is non-volatile, return the computed value of the assignment.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1127,9 +1127,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
 | 
			
		|||
    if (E->Classify(CGF.getContext()).isGLValue()) {
 | 
			
		||||
      LValue LV = CGF.EmitLValue(E);
 | 
			
		||||
      if (LV.isPropertyRef())
 | 
			
		||||
        CGF.EmitLoadOfPropertyRefLValue(LV, E->getType());
 | 
			
		||||
      else if (LV.isKVCRef())
 | 
			
		||||
        CGF.EmitLoadOfKVCRefLValue(LV, E->getType());
 | 
			
		||||
        CGF.EmitLoadOfPropertyRefLValue(LV);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      CGF.EmitAnyExpr(E, AggValueSlot::ignored(), true);
 | 
			
		||||
| 
						 | 
				
			
			@ -1583,7 +1581,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E,
 | 
			
		|||
    return RHS;
 | 
			
		||||
 | 
			
		||||
  // Objective-C property assignment never reloads the value following a store.
 | 
			
		||||
  if (LHS.isPropertyRef() || LHS.isKVCRef())
 | 
			
		||||
  if (LHS.isPropertyRef())
 | 
			
		||||
    return RHS;
 | 
			
		||||
 | 
			
		||||
  // If the lvalue is non-volatile, return the computed value of the assignment.
 | 
			
		||||
| 
						 | 
				
			
			@ -2183,7 +2181,7 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
 | 
			
		|||
    return RHS;
 | 
			
		||||
 | 
			
		||||
  // Objective-C property assignment never reloads the value following a store.
 | 
			
		||||
  if (LHS.isPropertyRef() || LHS.isKVCRef())
 | 
			
		||||
  if (LHS.isPropertyRef())
 | 
			
		||||
    return RHS;
 | 
			
		||||
 | 
			
		||||
  // If the lvalue is non-volatile, return the computed value of the assignment.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -528,8 +528,9 @@ RValue CodeGenFunction::EmitObjCSuperPropertyGet(const Expr *Exp,
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E,
 | 
			
		||||
                                            ReturnValueSlot Return) {
 | 
			
		||||
RValue CodeGenFunction::EmitLoadOfPropertyRefLValue(LValue LV,
 | 
			
		||||
                                                    ReturnValueSlot Return) {
 | 
			
		||||
  const ObjCPropertyRefExpr *E = LV.getPropertyRefExpr();
 | 
			
		||||
  QualType ResultType;
 | 
			
		||||
  Selector S;
 | 
			
		||||
  if (E->isExplicitProperty()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -545,14 +546,9 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const ObjCPropertyRefExpr *E,
 | 
			
		|||
  if (E->isSuperReceiver())
 | 
			
		||||
    return EmitObjCSuperPropertyGet(E, S, Return);
 | 
			
		||||
 | 
			
		||||
  llvm::Value *Receiver;
 | 
			
		||||
  const ObjCInterfaceDecl *ReceiverClass = 0;
 | 
			
		||||
  if (E->isClassReceiver()) {
 | 
			
		||||
    ReceiverClass = E->getClassReceiver();
 | 
			
		||||
    Receiver = CGM.getObjCRuntime().GetClass(Builder, ReceiverClass);
 | 
			
		||||
  } else {
 | 
			
		||||
    Receiver = EmitScalarExpr(E->getBase());
 | 
			
		||||
  }
 | 
			
		||||
  llvm::Value *Receiver = LV.getPropertyRefBaseAddr();
 | 
			
		||||
  const ObjCInterfaceDecl *ReceiverClass
 | 
			
		||||
    = (E->isClassReceiver() ? E->getClassReceiver() : 0);
 | 
			
		||||
  return CGM.getObjCRuntime().
 | 
			
		||||
             GenerateMessageSend(*this, Return, ResultType, S,
 | 
			
		||||
                                 Receiver, CallArgList(), ReceiverClass);
 | 
			
		||||
| 
						 | 
				
			
			@ -579,8 +575,9 @@ void CodeGenFunction::EmitObjCSuperPropertySet(const Expr *Exp,
 | 
			
		|||
  return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E,
 | 
			
		||||
                                          RValue Src) {
 | 
			
		||||
void CodeGenFunction::EmitStoreThroughPropertyRefLValue(RValue Src,
 | 
			
		||||
                                                        LValue Dst) {
 | 
			
		||||
  const ObjCPropertyRefExpr *E = Dst.getPropertyRefExpr();
 | 
			
		||||
  Selector S = E->getSetterSelector();
 | 
			
		||||
  QualType ArgType;
 | 
			
		||||
  if (E->isImplicitProperty()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -596,14 +593,9 @@ void CodeGenFunction::EmitObjCPropertySet(const ObjCPropertyRefExpr *E,
 | 
			
		|||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const ObjCInterfaceDecl *ReceiverClass = 0;
 | 
			
		||||
  llvm::Value *Receiver;
 | 
			
		||||
  if (E->isClassReceiver()) {
 | 
			
		||||
    ReceiverClass = E->getClassReceiver();
 | 
			
		||||
    Receiver = CGM.getObjCRuntime().GetClass(Builder, ReceiverClass);
 | 
			
		||||
  } else {
 | 
			
		||||
    Receiver = EmitScalarExpr(E->getBase());
 | 
			
		||||
  }
 | 
			
		||||
  llvm::Value *Receiver = Dst.getPropertyRefBaseAddr();
 | 
			
		||||
  const ObjCInterfaceDecl *ReceiverClass
 | 
			
		||||
    = (E->isClassReceiver() ? E->getClassReceiver() : 0);
 | 
			
		||||
 | 
			
		||||
  CallArgList Args;
 | 
			
		||||
  Args.push_back(std::make_pair(Src, ArgType));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,10 +108,8 @@ class LValue {
 | 
			
		|||
    VectorElt,    // This is a vector element l-value (V[i]), use getVector*
 | 
			
		||||
    BitField,     // This is a bitfield l-value, use getBitfield*.
 | 
			
		||||
    ExtVectorElt, // This is an extended vector subset, use getExtVectorComp
 | 
			
		||||
    PropertyRef,  // This is an Objective-C property reference, use
 | 
			
		||||
    PropertyRef   // This is an Objective-C property reference, use
 | 
			
		||||
                  // getPropertyRefExpr
 | 
			
		||||
    KVCRef        // This is an objective-c 'implicit' property ref,
 | 
			
		||||
                  // use getKVCRefExpr
 | 
			
		||||
  } LVType;
 | 
			
		||||
 | 
			
		||||
  llvm::Value *V;
 | 
			
		||||
| 
						 | 
				
			
			@ -177,7 +175,6 @@ public:
 | 
			
		|||
  bool isBitField() const { return LVType == BitField; }
 | 
			
		||||
  bool isExtVectorElt() const { return LVType == ExtVectorElt; }
 | 
			
		||||
  bool isPropertyRef() const { return LVType == PropertyRef; }
 | 
			
		||||
  bool isKVCRef() const { return LVType == KVCRef; }
 | 
			
		||||
 | 
			
		||||
  bool isVolatileQualified() const { return Quals.hasVolatile(); }
 | 
			
		||||
  bool isRestrictQualified() const { return Quals.hasRestrict(); }
 | 
			
		||||
| 
						 | 
				
			
			@ -245,17 +242,15 @@ public:
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  // property ref lvalue
 | 
			
		||||
  llvm::Value *getPropertyRefBaseAddr() const {
 | 
			
		||||
    assert(isPropertyRef());
 | 
			
		||||
    return V;
 | 
			
		||||
  }
 | 
			
		||||
  const ObjCPropertyRefExpr *getPropertyRefExpr() const {
 | 
			
		||||
    assert(isPropertyRef());
 | 
			
		||||
    return PropertyRefExpr;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 'implicit' property ref lvalue
 | 
			
		||||
  const ObjCPropertyRefExpr *getKVCRefExpr() const {
 | 
			
		||||
    assert(isKVCRef());
 | 
			
		||||
    return PropertyRefExpr;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static LValue MakeAddr(llvm::Value *V, QualType T, unsigned Alignment,
 | 
			
		||||
                         ASTContext &Context,
 | 
			
		||||
                         llvm::MDNode *TBAAInfo = 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -309,20 +304,12 @@ public:
 | 
			
		|||
  // the lvalue. However, this complicates the code a bit, and I haven't figured
 | 
			
		||||
  // out how to make it go wrong yet.
 | 
			
		||||
  static LValue MakePropertyRef(const ObjCPropertyRefExpr *E,
 | 
			
		||||
                                unsigned CVR) {
 | 
			
		||||
                                llvm::Value *Base) {
 | 
			
		||||
    LValue R;
 | 
			
		||||
    R.LVType = PropertyRef;
 | 
			
		||||
    R.V = Base;
 | 
			
		||||
    R.PropertyRefExpr = E;
 | 
			
		||||
    R.Initialize(Qualifiers::fromCVRMask(CVR));
 | 
			
		||||
    return R;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static LValue MakeKVCRef(const ObjCPropertyRefExpr *E,
 | 
			
		||||
                           unsigned CVR) {
 | 
			
		||||
    LValue R;
 | 
			
		||||
    R.LVType = KVCRef;
 | 
			
		||||
    R.PropertyRefExpr = E;
 | 
			
		||||
    R.Initialize(Qualifiers::fromCVRMask(CVR));
 | 
			
		||||
    R.Initialize(Qualifiers());
 | 
			
		||||
    return R;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1382,9 +1382,8 @@ public:
 | 
			
		|||
  RValue EmitLoadOfLValue(LValue V, QualType LVType);
 | 
			
		||||
  RValue EmitLoadOfExtVectorElementLValue(LValue V, QualType LVType);
 | 
			
		||||
  RValue EmitLoadOfBitfieldLValue(LValue LV, QualType ExprType);
 | 
			
		||||
  RValue EmitLoadOfPropertyRefLValue(LValue LV, QualType ExprType);
 | 
			
		||||
  RValue EmitLoadOfKVCRefLValue(LValue LV, QualType ExprType);
 | 
			
		||||
 | 
			
		||||
  RValue EmitLoadOfPropertyRefLValue(LValue LV,
 | 
			
		||||
                                 ReturnValueSlot Return = ReturnValueSlot());
 | 
			
		||||
 | 
			
		||||
  /// EmitStoreThroughLValue - Store the specified rvalue into the specified
 | 
			
		||||
  /// lvalue, where both are guaranteed to the have the same type, and that type
 | 
			
		||||
| 
						 | 
				
			
			@ -1392,8 +1391,7 @@ public:
 | 
			
		|||
  void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
 | 
			
		||||
  void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst,
 | 
			
		||||
                                                QualType Ty);
 | 
			
		||||
  void EmitStoreThroughPropertyRefLValue(RValue Src, LValue Dst, QualType Ty);
 | 
			
		||||
  void EmitStoreThroughKVCRefLValue(RValue Src, LValue Dst, QualType Ty);
 | 
			
		||||
  void EmitStoreThroughPropertyRefLValue(RValue Src, LValue Dst);
 | 
			
		||||
 | 
			
		||||
  /// EmitStoreThroughLValue - Store Src into Dst with same constraints as
 | 
			
		||||
  /// EmitStoreThroughLValue.
 | 
			
		||||
| 
						 | 
				
			
			@ -1544,11 +1542,8 @@ public:
 | 
			
		|||
  llvm::Value *EmitObjCSelectorExpr(const ObjCSelectorExpr *E);
 | 
			
		||||
  RValue EmitObjCMessageExpr(const ObjCMessageExpr *E,
 | 
			
		||||
                             ReturnValueSlot Return = ReturnValueSlot());
 | 
			
		||||
  RValue EmitObjCPropertyGet(const ObjCPropertyRefExpr *E,
 | 
			
		||||
                             ReturnValueSlot Return = ReturnValueSlot());
 | 
			
		||||
  RValue EmitObjCSuperPropertyGet(const Expr *Exp, const Selector &S,
 | 
			
		||||
                                  ReturnValueSlot Return = ReturnValueSlot());
 | 
			
		||||
  void EmitObjCPropertySet(const ObjCPropertyRefExpr *E, RValue Src);
 | 
			
		||||
  void EmitObjCSuperPropertySet(const Expr *E, const Selector &S, RValue Src);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue