зеркало из https://github.com/microsoft/clang-1.git
Few more changes due to Daniel's feedback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
337c6b9f5d
Коммит
dbd32c20c5
|
@ -151,7 +151,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
|
|||
/// this method emits the address of the lvalue, then loads the result as an
|
||||
/// rvalue, returning the rvalue.
|
||||
RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) {
|
||||
if (LV.ObjcWeak()) {
|
||||
if (LV.isObjCWeak()) {
|
||||
// load of a __weak object.
|
||||
llvm::Value *AddrWeakObj = LV.getAddress();
|
||||
llvm::Value *read_weak = CGM.getObjCRuntime().EmitObjCWeakRead(*this,
|
||||
|
@ -335,22 +335,6 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV,
|
|||
/// is 'Ty'.
|
||||
void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
|
||||
QualType Ty) {
|
||||
if (Dst.ObjcWeak()) {
|
||||
// load of a __weak object.
|
||||
llvm::Value *LvalueDst = Dst.getAddress();
|
||||
llvm::Value *src = Src.getScalarVal();
|
||||
CGM.getObjCRuntime().EmitObjCWeakAssign(*this, src, LvalueDst);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Dst.ObjcStrong()) {
|
||||
// load of a __strong object.
|
||||
llvm::Value *LvalueDst = Dst.getAddress();
|
||||
llvm::Value *src = Src.getScalarVal();
|
||||
CGM.getObjCRuntime().EmitObjCGlobalAssign(*this, src, LvalueDst);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Dst.isSimple()) {
|
||||
if (Dst.isVectorElt()) {
|
||||
// Read/modify/write the vector, inserting the new element.
|
||||
|
@ -376,6 +360,22 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
|
|||
assert(0 && "Unknown LValue type");
|
||||
}
|
||||
|
||||
if (Dst.isObjCWeak()) {
|
||||
// load of a __weak object.
|
||||
llvm::Value *LvalueDst = Dst.getAddress();
|
||||
llvm::Value *src = Src.getScalarVal();
|
||||
CGM.getObjCRuntime().EmitObjCWeakAssign(*this, src, LvalueDst);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Dst.isObjCStrong()) {
|
||||
// load of a __strong object.
|
||||
llvm::Value *LvalueDst = Dst.getAddress();
|
||||
llvm::Value *src = Src.getScalarVal();
|
||||
CGM.getObjCRuntime().EmitObjCGlobalAssign(*this, src, LvalueDst);
|
||||
return;
|
||||
}
|
||||
|
||||
llvm::Value *DstAddr = Dst.getAddress();
|
||||
assert(Src.isScalar() && "Can't emit an agg store with this method");
|
||||
// FIXME: Handle volatility etc.
|
||||
|
|
|
@ -1788,6 +1788,7 @@ void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E,
|
|||
llvm::Value * CGObjCMac::EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF,
|
||||
llvm::Value *AddrWeakObj)
|
||||
{
|
||||
AddrWeakObj = CGF.Builder.CreateBitCast(AddrWeakObj, ObjCTypes.PtrObjectPtrTy);
|
||||
llvm::Value *read_weak = CGF.Builder.CreateCall(ObjCTypes.GcReadWeakFn,
|
||||
AddrWeakObj, "weakread");
|
||||
return read_weak;
|
||||
|
@ -1799,6 +1800,8 @@ llvm::Value * CGObjCMac::EmitObjCWeakRead(CodeGen::CodeGenFunction &CGF,
|
|||
void CGObjCMac::EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,
|
||||
llvm::Value *src, llvm::Value *dst)
|
||||
{
|
||||
src = CGF.Builder.CreateBitCast(src, ObjCTypes.ObjectPtrTy);
|
||||
dst = CGF.Builder.CreateBitCast(dst, ObjCTypes.PtrObjectPtrTy);
|
||||
CGF.Builder.CreateCall2(ObjCTypes.GcAssignWeakFn,
|
||||
src, dst, "weakassign");
|
||||
return;
|
||||
|
@ -1810,6 +1813,8 @@ void CGObjCMac::EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,
|
|||
void CGObjCMac::EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF,
|
||||
llvm::Value *src, llvm::Value *dst)
|
||||
{
|
||||
src = CGF.Builder.CreateBitCast(src, ObjCTypes.ObjectPtrTy);
|
||||
dst = CGF.Builder.CreateBitCast(dst, ObjCTypes.PtrObjectPtrTy);
|
||||
CGF.Builder.CreateCall2(ObjCTypes.GcAssignGlobalFn,
|
||||
src, dst, "globalassign");
|
||||
return;
|
||||
|
@ -1821,6 +1826,8 @@ void CGObjCMac::EmitObjCGlobalAssign(CodeGen::CodeGenFunction &CGF,
|
|||
void CGObjCMac::EmitObjCStrongCastAssign(CodeGen::CodeGenFunction &CGF,
|
||||
llvm::Value *src, llvm::Value *dst)
|
||||
{
|
||||
src = CGF.Builder.CreateBitCast(src, ObjCTypes.ObjectPtrTy);
|
||||
dst = CGF.Builder.CreateBitCast(dst, ObjCTypes.PtrObjectPtrTy);
|
||||
CGF.Builder.CreateCall2(ObjCTypes.GcAssignStrongCastFn,
|
||||
src, dst, "weakassign");
|
||||
return;
|
||||
|
|
|
@ -159,8 +159,8 @@ public:
|
|||
bool isVolatileQualified() const { return Volatile; }
|
||||
bool isRestrictQualified() const { return Restrict; }
|
||||
|
||||
bool ObjcWeak() const { return ObjCType == Weak; }
|
||||
bool ObjcStrong() const { return ObjCType == Strong; }
|
||||
bool isObjCWeak() const { return ObjCType == Weak; }
|
||||
bool isObjCStrong() const { return ObjCType == Strong; }
|
||||
|
||||
static void SetObjCType(unsigned WeakVal, unsigned StrongVal, LValue& R) {
|
||||
if (WeakVal)
|
||||
|
|
Загрузка…
Ссылка в новой задаче