V = CGM.getStaticLocalDeclAddress(VD);
assert(V && "DeclRefExpr not entered in LocalDeclMap?");
- Qualifiers Quals = MakeQualifiers(E->getType());
- // local variables do not get their gc attribute set.
- // local static?
- if (NonGCable) Quals.removeObjCGCAttr();
-
if (VD->hasAttr<BlocksAttr>()) {
V = Builder.CreateStructGEP(V, 1, "forwarding");
V = Builder.CreateLoad(V);
}
if (VD->getType()->isReferenceType())
V = Builder.CreateLoad(V, "tmp");
- LValue LV = LValue::MakeAddr(V, Quals);
+
+ LValue LV = MakeAddrLValue(V, E->getType());
if (NonGCable) {
+ LV.getQuals().removeObjCGCAttr();
LV.setNonGC(true);
}
setObjCGCLValueClass(getContext(), E, LV);
QualType T = E->getSubExpr()->getType()->getPointeeType();
assert(!T.isNull() && "CodeGenFunction::EmitUnaryOpLValue: Illegal type");
- Qualifiers Quals = MakeQualifiers(T);
- Quals.setAddressSpace(ExprTy.getAddressSpace());
+ LValue LV = MakeAddrLValue(EmitScalarExpr(E->getSubExpr()), T);
+ LV.getQuals().setAddressSpace(ExprTy.getAddressSpace());
- LValue LV = LValue::MakeAddr(EmitScalarExpr(E->getSubExpr()), Quals);
// We should not generate __weak write barrier on indirect reference
// of a pointer to object; as in void foo (__weak id *param); *param = 0;
// But, we continue to generate __strong write barrier on indirect write
assert(!T.isNull() &&
"CodeGenFunction::EmitArraySubscriptExpr(): Illegal base type");
- Qualifiers Quals = MakeQualifiers(T);
- Quals.setAddressSpace(E->getBase()->getType().getAddressSpace());
+ LValue LV = MakeAddrLValue(Address, T);
+ LV.getQuals().setAddressSpace(E->getBase()->getType().getAddressSpace());
- LValue LV = LValue::MakeAddr(Address, Quals);
if (getContext().getLangOptions().ObjC1 &&
getContext().getLangOptions().getGCMode() != LangOptions::NonGC) {
LV.setNonGC(!E->isOBJCGCCandidate(getContext()));
// it.
llvm::Value *Ptr = EmitScalarExpr(E->getBase());
const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
- Qualifiers Quals = MakeQualifiers(PT->getPointeeType());
- Quals.removeObjCGCAttr();
- Base = LValue::MakeAddr(Ptr, Quals);
+ Base = MakeAddrLValue(Ptr, PT->getPointeeType());
+ Base.getQuals().removeObjCGCAttr();
} else if (E->getBase()->isLvalue(getContext()) == Expr::LV_Valid) {
// Otherwise, if the base is an lvalue ( as in the case of foo.x.x),
// emit the base as an lvalue.
// Store the vector to memory (because LValue wants an address).
llvm::Value *VecMem = CreateMemTemp(E->getBase()->getType());
Builder.CreateStore(Vec, VecMem);
- Base = LValue::MakeAddr(VecMem, Qualifiers());
+ Base = MakeAddrLValue(VecMem, E->getBase()->getType());
}
// Encode the element access list into a vector of unsigned indices.
if (Field->getType()->isReferenceType())
V = Builder.CreateLoad(V, "tmp");
- Qualifiers Quals = MakeQualifiers(Field->getType());
- Quals.addCVRQualifiers(CVRQualifiers);
+ LValue LV = MakeAddrLValue(V, Field->getType());
+ LV.getQuals().addCVRQualifiers(CVRQualifiers);
+
// __weak attribute on a field is ignored.
- if (Quals.getObjCGCAttr() == Qualifiers::Weak)
- Quals.removeObjCGCAttr();
+ if (LV.getQuals().getObjCGCAttr() == Qualifiers::Weak)
+ LV.getQuals().removeObjCGCAttr();
- return LValue::MakeAddr(V, Quals);
+ return LV;
}
LValue
V = CGF.Builder.CreateGEP(V, Offset, "add.ptr");
V = CGF.Builder.CreateBitCast(V, llvm::PointerType::getUnqual(LTy));
- Qualifiers Quals = CGF.MakeQualifiers(IvarTy);
- Quals.addCVRQualifiers(CVRQualifiers);
-
- if (!Ivar->isBitField())
- return LValue::MakeAddr(V, Quals);
+ if (!Ivar->isBitField()) {
+ LValue LV = CGF.MakeAddrLValue(V, IvarTy);
+ LV.getQuals().addCVRQualifiers(CVRQualifiers);
+ return LV;
+ }
// We need to compute the bit offset for the bit-field, the offset is to the
// byte. Note, there is a subtle invariant here: we can only call this routine
// FIXME: We need to set a very conservative alignment on this, or make sure
// that the runtime is doing the right thing.
+ Qualifiers Quals = CGF.MakeQualifiers(IvarTy);
+ Quals.addCVRQualifiers(CVRQualifiers);
return LValue::MakeBitfield(V, *Info, Quals.getCVRQualifiers());
}