implement codegen for complex literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41414 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprComplex.cpp b/CodeGen/CGExprComplex.cpp
index b88133e..ce676e9 100644
--- a/CodeGen/CGExprComplex.cpp
+++ b/CodeGen/CGExprComplex.cpp
@@ -68,7 +68,8 @@
}
ComplexPairTy VisitExpr(Expr *S);
ComplexPairTy VisitParenExpr(ParenExpr *PE) { return Visit(PE->getSubExpr());}
-
+ ComplexPairTy VisitImaginaryLiteral(ImaginaryLiteral *IL);
+
// l-values.
ComplexPairTy VisitDeclRefExpr(Expr *E) { return EmitLoadOfLValue(E); }
ComplexPairTy VisitArraySubscriptExpr(Expr *E) { return EmitLoadOfLValue(E); }
@@ -170,6 +171,12 @@
return ComplexPairTy(U, U);
}
+ComplexPairTy ComplexExprEmitter::VisitImaginaryLiteral(ImaginaryLiteral *IL) {
+ llvm::Value *Imag = CGF.EmitScalarExpr(IL->getSubExpr());
+ return ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
+}
+
+
ComplexPairTy ComplexExprEmitter::VisitCallExpr(const CallExpr *E) {
llvm::Value *AggPtr = CGF.EmitCallExpr(E).getAggregateAddr();
return EmitLoadOfComplex(AggPtr, false);