Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType(). This fixes PR1960.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49220 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index a50e666..de138a1 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -466,7 +466,7 @@
if (!CGF.hasAggregateLLVMType(ArgTy)) {
// Scalar argument is passed by-value.
Args.push_back(CGF.EmitScalarExpr(ArgExpr));
- } else if (ArgTy->isComplexType()) {
+ } else if (ArgTy->isAnyComplexType()) {
// Make a temporary alloca to pass the argument.
llvm::Value *DestMem = CGF.CreateTempAlloca(ConvertType(ArgTy));
CGF.EmitComplexExprIntoAddr(ArgExpr, DestMem, false);
@@ -559,7 +559,7 @@
return EmitScalarConversion(Src, E->getType(), DestTy);
}
- if (E->getType()->isComplexType()) {
+ if (E->getType()->isAnyComplexType()) {
// Handle cases where the source is a complex type.
return EmitComplexToScalarConversion(CGF.EmitComplexExpr(E), E->getType(),
DestTy);
@@ -669,13 +669,13 @@
Value *ScalarExprEmitter::VisitUnaryReal(const UnaryOperator *E) {
Expr *Op = E->getSubExpr();
- if (Op->getType()->isComplexType())
+ if (Op->getType()->isAnyComplexType())
return CGF.EmitComplexExpr(Op).first;
return Visit(Op);
}
Value *ScalarExprEmitter::VisitUnaryImag(const UnaryOperator *E) {
Expr *Op = E->getSubExpr();
- if (Op->getType()->isComplexType())
+ if (Op->getType()->isAnyComplexType())
return CGF.EmitComplexExpr(Op).second;
// __imag on a scalar returns zero. Emit it the subexpr to ensure side
@@ -894,7 +894,7 @@
unsigned SICmpOpc, unsigned FCmpOpc) {
Value *Result;
QualType LHSTy = E->getLHS()->getType();
- if (!LHSTy->isComplexType()) {
+ if (!LHSTy->isAnyComplexType()) {
Value *LHS = Visit(E->getLHS());
Value *RHS = Visit(E->getRHS());
@@ -1130,7 +1130,7 @@
Value *CodeGenFunction::EmitComplexToScalarConversion(ComplexPairTy Src,
QualType SrcTy,
QualType DstTy) {
- assert(SrcTy->isComplexType() && !hasAggregateLLVMType(DstTy) &&
+ assert(SrcTy->isAnyComplexType() && !hasAggregateLLVMType(DstTy) &&
"Invalid complex -> scalar conversion");
return ScalarExprEmitter(*this).EmitComplexToScalarConversion(Src, SrcTy,
DstTy);