diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-08 22:33:23 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-08 22:33:23 +0000 |
commit | b19c76e857d21b722d0a207cb45b26d7cb20a73f (patch) | |
tree | 6f05ead8930173d239a1c8498dc163483e9d2d5d /lib/CodeGen/CGObjC.cpp | |
parent | 811d75ee35b8b061a9b10a4e7b81e0c0eaf739c3 (diff) |
Fix an IRGen bug in property setter calls when
setter and getter types mismatch. // rdar://8966864
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 1c64e3cb4c..066ae5ab3a 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -585,7 +585,17 @@ void CodeGenFunction::EmitStoreThroughPropertyRefLValue(RValue Src, } else { ArgType = E->getType(); } - + // FIXME. Other than scalars, AST is not adequate for setter and + // getter type mismatches which require conversion. + if (Src.isScalar()) { + llvm::Value *SrcVal = Src.getScalarVal(); + QualType DstType = getContext().getCanonicalType(ArgType); + const llvm::Type *DstTy = ConvertType(DstType); + if (SrcVal->getType() != DstTy) + Src = + RValue::get(EmitScalarConversion(SrcVal, E->getType(), DstType)); + } + CallArgList Args; Args.push_back(std::make_pair(Src, ArgType)); |