diff options
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index e1d042b..fbb3d48 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -108,6 +108,7 @@ public: return EmitLoadOfLValue(E); } ComplexPairTy VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { + assert(E->getObjectKind() == OK_Ordinary); return EmitLoadOfLValue(E); } ComplexPairTy VisitObjCMessageExpr(ObjCMessageExpr *E) { @@ -333,7 +334,21 @@ ComplexPairTy ComplexExprEmitter::EmitComplexToComplexCast(ComplexPairTy Val, ComplexPairTy ComplexExprEmitter::EmitCast(CastExpr::CastKind CK, Expr *Op, QualType DestTy) { - // FIXME: this should be based off of the CastKind. + switch (CK) { + case CK_GetObjCProperty: { + LValue LV = CGF.EmitLValue(Op); + assert(LV.isPropertyRef() && "Unknown LValue type!"); + return CGF.EmitLoadOfPropertyRefLValue(LV).getComplexVal(); + } + + case CK_NoOp: + case CK_LValueToRValue: + return Visit(Op); + + // TODO: do all of these + default: + break; + } // Two cases here: cast from (complex to complex) and (scalar to complex). if (Op->getType()->isAnyComplexType()) |
