if (!hasAggregateLLVMType(Init->getType())) {
llvm::Value *V = EmitScalarExpr(Init);
Builder.CreateStore(V, DeclPtr, D.getType().isVolatileQualified());
- } else if (Init->getType()->isComplexType()) {
+ } else if (Init->getType()->isAnyComplexType()) {
EmitComplexExprIntoAddr(Init, DeclPtr, D.getType().isVolatileQualified());
} else {
EmitAggExpr(Init, DeclPtr, D.getType().isVolatileQualified());
/// expression and compare the result against zero, returning an Int1Ty value.
llvm::Value *CodeGenFunction::EvaluateExprAsBool(const Expr *E) {
QualType BoolTy = getContext().BoolTy;
- if (!E->getType()->isComplexType())
+ if (!E->getType()->isAnyComplexType())
return EmitScalarConversion(EmitScalarExpr(E), E->getType(), BoolTy);
return EmitComplexToScalarConversion(EmitComplexExpr(E), E->getType(),BoolTy);
bool isAggLocVolatile) {
if (!hasAggregateLLVMType(E->getType()))
return RValue::get(EmitScalarExpr(E));
- else if (E->getType()->isComplexType())
+ else if (E->getType()->isAnyComplexType())
return RValue::getComplex(EmitComplexExpr(E));
EmitAggExpr(E, AggLoc, isAggLocVolatile);
if (!hasAggregateLLVMType(ArgTy)) {
// Scalar argument is passed by-value.
Args.push_back(EmitScalarExpr(ArgExprs[i]));
- } else if (ArgTy->isComplexType()) {
+ } else if (ArgTy->isAnyComplexType()) {
// Make a temporary alloca to pass the argument.
llvm::Value *DestMem = CreateTempAlloca(ConvertType(ArgTy));
EmitComplexExprIntoAddr(ArgExprs[i], DestMem, false);
CI->setCallingConv(F->getCallingConv());
if (CI->getType() != llvm::Type::VoidTy)
CI->setName("call");
- else if (ResultType->isComplexType())
+ else if (ResultType->isAnyComplexType())
return RValue::getComplex(LoadComplexFromAddr(Args[0], false));
else if (hasAggregateLLVMType(ResultType))
// Struct return.
//===----------------------------------------------------------------------===//
void AggExprEmitter::EmitAggregateClear(llvm::Value *DestPtr, QualType Ty) {
- assert(!Ty->isComplexType() && "Shouldn't happen for complex");
+ assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex");
// Aggregate assignment turns into llvm.memset.
const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
void AggExprEmitter::EmitAggregateCopy(llvm::Value *DestPtr,
llvm::Value *SrcPtr, QualType Ty) {
- assert(!Ty->isComplexType() && "Shouldn't happen for complex");
+ assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex");
// Aggregate assignment turns into llvm.memcpy.
const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
ComplexPairTy ComplexExprEmitter::EmitCast(Expr *Op, QualType DestTy) {
// Two cases here: cast from (complex to complex) and (scalar to complex).
- if (Op->getType()->isComplexType())
+ if (Op->getType()->isAnyComplexType())
return EmitComplexToComplexCast(Visit(Op), Op->getType(), DestTy);
// C99 6.3.1.7: When a value of real type is converted to a complex type, the
/// EmitComplexExpr - Emit the computation of the specified expression of
/// complex type, ignoring the result.
ComplexPairTy CodeGenFunction::EmitComplexExpr(const Expr *E) {
- assert(E && E->getType()->isComplexType() &&
+ assert(E && E->getType()->isAnyComplexType() &&
"Invalid complex expression to emit");
return ComplexExprEmitter(*this).Visit(const_cast<Expr*>(E));
void CodeGenFunction::EmitComplexExprIntoAddr(const Expr *E,
llvm::Value *DestAddr,
bool DestIsVolatile) {
- assert(E && E->getType()->isComplexType() &&
+ assert(E && E->getType()->isAnyComplexType() &&
"Invalid complex expression to emit");
ComplexExprEmitter Emitter(*this);
ComplexPairTy Val = Emitter.Visit(const_cast<Expr*>(E));
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);
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);
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
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());
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);
if (const Expr *E = dyn_cast<Expr>(S)) {
if (!hasAggregateLLVMType(E->getType()))
EmitScalarExpr(E);
- else if (E->getType()->isComplexType())
+ else if (E->getType()->isAnyComplexType())
EmitComplexExpr(E);
else
EmitAggExpr(E, 0, false);
Builder.CreateRet(llvm::UndefValue::get(RetTy));
} else if (!hasAggregateLLVMType(RV->getType())) {
Builder.CreateRet(EmitScalarExpr(RV));
- } else if (RV->getType()->isComplexType()) {
+ } else if (RV->getType()->isAnyComplexType()) {
llvm::Value *SRetPtr = CurFn->arg_begin();
EmitComplexExprIntoAddr(RV, SRetPtr, false);
} else {
-// RUN: clang -emit-llvm %s
+// RUN: clang -emit-llvm < %s
int main(void)
{
(__imag__ cf) = 4.0;
}
+// PR1960
+void t3() {
+ __complex__ long long v = 2;
+}
+